@univerjs/sheets-hyper-link-ui 0.1.13 → 0.1.14
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/lib/cjs/index.js +2 -2
- package/lib/es/index.js +631 -624
- package/lib/types/controllers/render-controllers/render.controller.d.ts +11 -7
- package/lib/types/index.d.ts +1 -1
- package/lib/types/plugin.d.ts +5 -4
- package/lib/types/types/const.d.ts +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +36 -22
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Workbook, Disposable, ThemeService } from '@univerjs/core';
|
|
2
2
|
import { SheetInterceptorService } from '@univerjs/sheets';
|
|
3
3
|
import { SheetSkeletonManagerService } from '@univerjs/sheets-ui';
|
|
4
|
-
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
4
|
+
import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
|
|
5
5
|
import { HyperLinkModel } from '@univerjs/sheets-hyper-link';
|
|
6
6
|
|
|
7
|
-
export declare class SheetsHyperLinkRenderController extends Disposable {
|
|
8
|
-
private readonly
|
|
7
|
+
export declare class SheetsHyperLinkRenderController extends Disposable implements IRenderModule {
|
|
8
|
+
private readonly _context;
|
|
9
9
|
private readonly _hyperLinkModel;
|
|
10
|
-
private readonly _univerInstanceService;
|
|
11
10
|
private readonly _sheetSkeletonManagerService;
|
|
12
11
|
private readonly _renderManagerService;
|
|
12
|
+
constructor(_context: IRenderContext<Workbook>, _hyperLinkModel: HyperLinkModel, _sheetSkeletonManagerService: SheetSkeletonManagerService, _renderManagerService: IRenderManagerService);
|
|
13
|
+
private _initSkeletonChange;
|
|
14
|
+
}
|
|
15
|
+
export declare class SheetsHyperLinkRenderManagerController extends Disposable {
|
|
16
|
+
private readonly _sheetInterceptorService;
|
|
17
|
+
private readonly _hyperLinkModel;
|
|
13
18
|
private readonly _themeService;
|
|
14
|
-
constructor(_sheetInterceptorService: SheetInterceptorService, _hyperLinkModel: HyperLinkModel,
|
|
19
|
+
constructor(_sheetInterceptorService: SheetInterceptorService, _hyperLinkModel: HyperLinkModel, _themeService: ThemeService);
|
|
15
20
|
private _initViewModelIntercept;
|
|
16
|
-
private _initSkeletonChange;
|
|
17
21
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export { SheetsHyperLinkRemoveSheetController } from './controllers/remove-sheet.controller';
|
|
17
17
|
export { SheetsHyperLinkRefRangeController } from './controllers/ref-range.controller';
|
|
18
|
-
export { SheetsHyperLinkRenderController } from './controllers/render-controllers/render.controller';
|
|
18
|
+
export { SheetsHyperLinkRenderManagerController, SheetsHyperLinkRenderController } from './controllers/render-controllers/render.controller';
|
|
19
19
|
export { SheetsHyperLinkPopupService } from './services/popup.service';
|
|
20
20
|
export { SheetsHyperLinkResolverService } from './services/resolver.service';
|
|
21
21
|
export { SheetHyperLinkSetRangeController } from './controllers/set-range.controller';
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Injector } from '@wendellhu/redi';
|
|
2
|
-
import { UniverInstanceType } from '@univerjs/core';
|
|
3
|
-
import {
|
|
2
|
+
import { Plugin, UniverInstanceType } from '@univerjs/core';
|
|
3
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
4
4
|
import { IUniverSheetsHyperLinkUIConfig } from './controllers/ui.controller';
|
|
5
5
|
|
|
6
|
-
export declare class UniverSheetsHyperLinkUIPlugin extends
|
|
6
|
+
export declare class UniverSheetsHyperLinkUIPlugin extends Plugin {
|
|
7
7
|
private _config;
|
|
8
8
|
protected _injector: Injector;
|
|
9
|
+
private readonly _renderManagerService;
|
|
9
10
|
static pluginName: string;
|
|
10
11
|
static type: UniverInstanceType;
|
|
11
|
-
constructor(_config: IUniverSheetsHyperLinkUIConfig, _injector: Injector);
|
|
12
|
+
constructor(_config: IUniverSheetsHyperLinkUIConfig, _injector: Injector, _renderManagerService: IRenderManagerService);
|
|
12
13
|
onStarting(injector: Injector): void;
|
|
13
14
|
}
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const SHEET_HYPER_LINK_UI_PLUGIN = "SHEET_HYPER_LINK_UI_PLUGIN";
|
|
17
17
|
export declare const ERROR_RANGE = "err";
|
package/lib/umd/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(l,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@wendellhu/redi"),require("@univerjs/sheets-hyper-link"),require("@univerjs/engine-formula"),require("@univerjs/design"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("@univerjs/engine-render"),require("rxjs"),require("react"),require("@wendellhu/redi/react-bindings"),require("clsx"),require("@univerjs/sheets-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@wendellhu/redi","@univerjs/sheets-hyper-link","@univerjs/engine-formula","@univerjs/design","@univerjs/sheets-ui","@univerjs/ui","@univerjs/engine-render","rxjs","react","@wendellhu/redi/react-bindings","clsx","@univerjs/sheets-formula"],s):(l=typeof globalThis<"u"?globalThis:l||self,s(l.UniverSheetsHyperLinkUi={},l.UniverCore,l.UniverSheets,l["@wendellhu/redi"],l.UniverSheetsHyperLink,l.UniverEngineFormula,l.UniverDesign,l.UniverSheetsUi,l.UniverUi,l.UniverEngineRender,l.rxjs,l.React,l["@wendellhu/redi/react-bindings"],l.clsx,l.UniverSheetsFormula))})(this,function(l,s,p,S,v,H,I,_,O,Ae,pe,C,w,Le,Ve){"use strict";var rn=Object.defineProperty;var on=(l,s,p)=>s in l?rn(l,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[s]=p;var A=(l,s,p)=>(on(l,typeof s!="symbol"?s+"":s,p),p);var de;var We=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,$e=(i,n,t,e)=>{for(var r=e>1?void 0:e?xe(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&We(n,t,r),r},he=(i,n)=>(t,e)=>n(t,e,i);l.SheetsHyperLinkRemoveSheetController=class extends s.Disposable{constructor(n,t,e){super(),this._sheetInterceptorService=n,this._univerInstanceService=t,this._hyperLinkModel=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:n=>{if(n.id===p.RemoveSheetCommand.id){const t=n.params,e=t.unitId?this._univerInstanceService.getUnit(t.unitId):this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),o=t.subUnitId||e.getActiveSheet().getSheetId(),a=this._hyperLinkModel.getSubUnit(r,o),c=a.map(u=>({id:v.RemoveHyperLinkCommand.id,params:{unitId:r,subUnitId:o,id:u.id}})),d=a.map(u=>({id:v.AddHyperLinkCommand.id,params:{unitId:r,subUnitId:o,link:u}}));return{redos:c,undos:d}}return{redos:[],undos:[]}}}))}},l.SheetsHyperLinkRemoveSheetController=$e([s.OnLifecycle(s.LifecycleStages.Ready,l.SheetsHyperLinkRemoveSheetController),he(0,S.Inject(p.SheetInterceptorService)),he(1,s.IUniverInstanceService),he(2,S.Inject(v.HyperLinkModel))],l.SheetsHyperLinkRemoveSheetController);const ve="SHEETS_HYPER_LINK_UI_PLUGIN",me="err";var Be=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,ze=(i,n,t,e)=>{for(var r=e>1?void 0:e?Fe(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&Be(n,t,r),r},X=(i,n)=>(t,e)=>n(t,e,i);function Ye(i,n){const t=[];return n.forEach(e=>{s.Rectangle.intersects(i,e)&&t.push(e)}),s.Rectangle.realUnion(i,...t)}l.SheetsHyperLinkResolverService=class{constructor(n,t,e,r,o){this._univerInstanceService=n,this._commandService=t,this._definedNamesService=e,this._messageService=r,this._localeService=o}_getURLName(n){var d;const{gid:t,range:e,rangeid:r}=n,o=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const a=t?o.getSheetBySheetId(t):o.getActiveSheet(),c=(d=a==null?void 0:a.getName())!=null?d:"";if(e){const u=H.deserializeRangeWithSheet(e).range;return s.isValidRange(u)&&e!==me?{type:"range",name:H.serializeRangeWithSheet(c,u)}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(r){const u=this._definedNamesService.getValueById(o.getUnitId(),r);return u?{type:"defineName",name:u.formulaOrRefString}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(t){const u=o.getSheetBySheetId(t);return u?{type:"sheet",name:u.getName()}:{type:"sheet-error",name:this._localeService.t("hyperLink.message.refError")}}return null}navigateTo(n){const{gid:t,range:e,rangeid:r}=n,o=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!o)return;const a=o.getUnitId();if(r&&this.navigateToDefineName(a,r),!!t){if(e){const c=H.deserializeRangeWithSheet(e);s.isValidRange(c.range)&&e!==me&&this.navigateToRange(a,t,c.range);return}this.navigateToSheetById(a,t)}}parseHyperLink(n){var t,e,r;if(n!=null&&n.startsWith("#")){const o=new URLSearchParams(n.slice(1)),a={gid:(t=o.get("gid"))!=null?t:"",range:(e=o.get("range"))!=null?e:"",rangeid:(r=o.get("rangeid"))!=null?r:""},c=this._getURLName(a);return{type:(c==null?void 0:c.type)||"link",name:(c==null?void 0:c.name)||n,url:n,searchObj:a,handler:()=>{this.navigateTo(a)}}}else return{type:"outer",name:n,url:n,handler:()=>{this.navigateToOtherWebsite(n)}}}async navigateToRange(n,t,e){const r=await this.navigateToSheetById(n,t);if(r){const o=Ye(e,r.getMergeData());await this._commandService.executeCommand(p.SetSelectionsOperation.id,{unitId:n,subUnitId:t,pluginName:p.NORMAL_SELECTION_PLUGIN_NAME,selections:[{range:o}]}),await this._commandService.executeCommand(_.ScrollToCellCommand.id,{range:o})}}async navigateToSheet(n,t){const e=this._univerInstanceService.getUnit(n,s.UniverInstanceType.UNIVER_SHEET);if(!e)return!1;const r=e.getActiveSheet();if((r==null?void 0:r.getName())===t)return!0;const o=e.getSheetBySheetName(t);if(!o){this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error});return}const a=o.getSheetId();return e.getHiddenWorksheets().indexOf(a)>-1&&this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:n,subUnitId:a})}async navigateToSheetById(n,t){const e=this._univerInstanceService.getUnit(n,s.UniverInstanceType.UNIVER_SHEET);if(!e)return!1;const r=e.getActiveSheet();if(r.getSheetId()===t)return r;const o=e.getSheetBySheetId(t);return o?e.getHiddenWorksheets().indexOf(t)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),!1):await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:n,subUnitId:t})?o:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error}),!1)}async navigateToDefineName(n,t){return this._definedNamesService.focusRange(n,t),!0}async navigateToOtherWebsite(n){window.open(n,"_blank","noopener noreferrer")}},l.SheetsHyperLinkResolverService=ze([X(0,s.IUniverInstanceService),X(1,s.ICommandService),X(2,H.IDefinedNamesService),X(3,O.IMessageService),X(4,S.Inject(s.LocaleService))],l.SheetsHyperLinkResolverService);var Ze=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Ge=(i,n,t,e)=>{for(var r=e>1?void 0:e?Ke(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&Ze(n,t,r),r},ne=(i,n)=>(t,e)=>n(t,e,i);l.SheetsHyperLinkRefRangeController=class extends s.Disposable{constructor(t,e,r,o){super();A(this,"_disposableMap",new Map);A(this,"_rangeDisableMap",new Map);this._refRangeService=t,this._hyperLinkModel=e,this._resolverService=r,this._univerInstanceService=o,this._initData(),this._initRefRange()}_register(t,e,r){const o=r.id,a={startColumn:r.column,endColumn:r.column,startRow:r.row,endRow:r.row},c=d=>{const u=p.handleDefaultRangeChangeWithEffectRefCommands(a,d);return u&&u.startColumn===a.startColumn&&u.startRow===a.startRow?{undos:[],redos:[]}:u?{redos:[{id:v.UpdateHyperLinkRefMutation.id,params:{unitId:t,subUnitId:e,id:r.id,row:u.startRow,column:u.startColumn}}],undos:[{id:v.UpdateHyperLinkRefMutation.id,params:{unitId:t,subUnitId:e,id:r.id,row:a.startRow,column:a.startColumn}}]}:{redos:[{id:v.RemoveHyperLinkMutation.id,params:{unitId:t,subUnitId:e,id:r.id}}],undos:[{id:v.AddHyperLinkMutation.id,params:{unitId:t,subUnitId:e,link:r}}]}};this._disposableMap.set(o,this._refRangeService.registerRefRange(a,c,t,e))}_unregister(t){const e=this._disposableMap.get(t);e==null||e.dispose(),this._disposableMap.delete(t)}_registerRange(t,e,r){const o=this._resolverService.parseHyperLink(r);if(o.searchObj&&o.searchObj.range&&o.searchObj.gid){const a=o.searchObj.gid,c=H.deserializeRangeWithSheet(o.searchObj.range).range;if(s.isValidRange(c)&&o.searchObj.range!==me){const d=u=>{const g=p.handleDefaultRangeChangeWithEffectRefCommands(c,u);return g&&H.serializeRange(g)===H.serializeRange(c)?{redos:[],undos:[]}:{redos:[{id:v.UpdateHyperLinkMutation.id,params:{unitId:t,subUnitId:a,id:e,payload:{payload:`#gid=${a}&range=${g?H.serializeRange(g):"err"}`}}}],undos:[{id:v.UpdateHyperLinkMutation.id,params:{unitId:t,subUnitId:a,id:e,payload:{payload:r}}}]}};this._rangeDisableMap.set(e,this._refRangeService.registerRefRange(c,d,t,a))}}}_unregisterRange(t){const e=this._rangeDisableMap.get(t);e==null||e.dispose(),this._rangeDisableMap.delete(t)}_initData(){this._hyperLinkModel.getAll().forEach(e=>{e.forEach(r=>{const{unitId:o,subUnitId:a,links:c}=r;c.forEach(d=>{this._register(o,a,d)})})})}_initRefRange(){this.disposeWithMe(this._hyperLinkModel.linkUpdate$.subscribe(t=>{switch(t.type){case"add":{this._register(t.unitId,t.subUnitId,t.payload),this._registerRange(t.unitId,t.payload.id,t.payload.payload);break}case"remove":{this._unregister(t.payload.id),this._unregisterRange(t.payload.id);break}case"updateRef":{const{unitId:e,subUnitId:r,id:o}=t,a=this._hyperLinkModel.getHyperLink(e,r,o);if(!a)return;this._unregister(o),this._register(e,r,a);break}case"unload":{const{unitLinks:e}=t;e.forEach(r=>{const{links:o}=r;o.forEach(a=>{this._unregister(a.id),this._unregisterRange(a.id)})});break}case"update":{this._unregisterRange(t.id),this._registerRange(t.unitId,t.id,t.payload.payload);break}}})),this.disposeWithMe(s.toDisposable(()=>{this._disposableMap.forEach(t=>{t.dispose()}),this._disposableMap.clear()}))}},l.SheetsHyperLinkRefRangeController=Ge([s.OnLifecycle(s.LifecycleStages.Starting,l.SheetsHyperLinkRefRangeController),ne(0,S.Inject(p.RefRangeService)),ne(1,S.Inject(v.HyperLinkModel)),ne(2,S.Inject(l.SheetsHyperLinkResolverService)),ne(3,s.IUniverInstanceService)],l.SheetsHyperLinkRefRangeController);var Xe=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Qe=(i,n,t,e)=>{for(var r=e>1?void 0:e?Je(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&Xe(n,t,r),r},z=(i,n)=>(t,e)=>n(t,e,i);l.SheetsHyperLinkRenderController=class extends s.Disposable{constructor(n,t,e,r,o,a){super(),this._sheetInterceptorService=n,this._hyperLinkModel=t,this._univerInstanceService=e,this._sheetSkeletonManagerService=r,this._renderManagerService=o,this._themeService=a,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(n,t,e)=>{const{row:r,col:o,unitId:a,subUnitId:c}=t,d=this._hyperLinkModel.getHyperLinkByLocation(a,c,r,o),u=this._themeService.getCurrentTheme();return e(d?{...n,interceptorStyle:{ul:{s:s.BooleanNumber.TRUE},cl:{rgb:u.blue500}}}:n)},priority:100}))}_initSkeletonChange(){const n=()=>{const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!t)return;const e=t.getUnitId(),r=t.getActiveSheet().getSheetId(),o=this._sheetSkeletonManagerService.getOrCreateSkeleton({unitId:e,sheetId:r}),a=this._renderManagerService.getRenderById(e);o==null||o.makeDirty(!0),o==null||o.calculate(),a&&a.mainComponent.makeForceDirty()};this.disposeWithMe(this._hyperLinkModel.linkUpdate$.subscribe(()=>{n()}))}},l.SheetsHyperLinkRenderController=Qe([s.OnLifecycle(s.LifecycleStages.Ready,l.SheetsHyperLinkRenderController),z(0,S.Inject(p.SheetInterceptorService)),z(1,S.Inject(v.HyperLinkModel)),z(2,s.IUniverInstanceService),z(3,S.Inject(_.SheetSkeletonManagerService)),z(4,Ae.IRenderManagerService),z(5,S.Inject(s.ThemeService))],l.SheetsHyperLinkRenderController);var ke={exports:{}},re={};/**
|
|
1
|
+
(function(s,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@wendellhu/redi"),require("@univerjs/sheets-hyper-link"),require("@univerjs/engine-formula"),require("@univerjs/design"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("@univerjs/engine-render"),require("rxjs"),require("react"),require("@wendellhu/redi/react-bindings"),require("clsx"),require("@univerjs/sheets-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@wendellhu/redi","@univerjs/sheets-hyper-link","@univerjs/engine-formula","@univerjs/design","@univerjs/sheets-ui","@univerjs/ui","@univerjs/engine-render","rxjs","react","@wendellhu/redi/react-bindings","clsx","@univerjs/sheets-formula"],l):(s=typeof globalThis<"u"?globalThis:s||self,l(s.UniverSheetsHyperLinkUi={},s.UniverCore,s.UniverSheets,s["@wendellhu/redi"],s.UniverSheetsHyperLink,s.UniverEngineFormula,s.UniverDesign,s.UniverSheetsUi,s.UniverUi,s.UniverEngineRender,s.rxjs,s.React,s["@wendellhu/redi/react-bindings"],s.clsx,s.UniverSheetsFormula))})(this,function(s,l,p,S,v,H,I,_,M,Ce,ue,C,w,Le,xe){"use strict";var ot=Object.defineProperty;var at=(s,l,p)=>l in s?ot(s,l,{enumerable:!0,configurable:!0,writable:!0,value:p}):s[l]=p;var V=(s,l,p)=>(at(s,typeof l!="symbol"?l+"":l,p),p);var Be=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,ze=(i,t,n,e)=>{for(var r=e>1?void 0:e?Fe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Be(t,n,r),r},pe=(i,t)=>(n,e)=>t(n,e,i);s.SheetsHyperLinkRemoveSheetController=class extends l.Disposable{constructor(t,n,e){super(),this._sheetInterceptorService=t,this._univerInstanceService=n,this._hyperLinkModel=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{if(t.id===p.RemoveSheetCommand.id){const n=t.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(l.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),o=n.subUnitId||e.getActiveSheet().getSheetId(),a=this._hyperLinkModel.getSubUnit(r,o),c=a.map(u=>({id:v.RemoveHyperLinkCommand.id,params:{unitId:r,subUnitId:o,id:u.id}})),d=a.map(u=>({id:v.AddHyperLinkCommand.id,params:{unitId:r,subUnitId:o,link:u}}));return{redos:c,undos:d}}return{redos:[],undos:[]}}}))}},s.SheetsHyperLinkRemoveSheetController=ze([l.OnLifecycle(l.LifecycleStages.Ready,s.SheetsHyperLinkRemoveSheetController),pe(0,S.Inject(p.SheetInterceptorService)),pe(1,l.IUniverInstanceService),pe(2,S.Inject(v.HyperLinkModel))],s.SheetsHyperLinkRemoveSheetController);const he="SHEET_HYPER_LINK_UI_PLUGIN",ve="err";var Ye=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,Ke=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ze(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ye(t,n,r),r},X=(i,t)=>(n,e)=>t(n,e,i);function Ge(i,t){const n=[];return t.forEach(e=>{l.Rectangle.intersects(i,e)&&n.push(e)}),l.Rectangle.realUnion(i,...n)}s.SheetsHyperLinkResolverService=class{constructor(t,n,e,r,o){this._univerInstanceService=t,this._commandService=n,this._definedNamesService=e,this._messageService=r,this._localeService=o}_getURLName(t){var d;const{gid:n,range:e,rangeid:r}=t,o=this._univerInstanceService.getCurrentUnitForType(l.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const a=n?o.getSheetBySheetId(n):o.getActiveSheet(),c=(d=a==null?void 0:a.getName())!=null?d:"";if(e){const u=H.deserializeRangeWithSheet(e).range;return l.isValidRange(u)&&e!==ve?{type:"range",name:H.serializeRangeWithSheet(c,u)}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(r){const u=this._definedNamesService.getValueById(o.getUnitId(),r);return u?{type:"defineName",name:u.formulaOrRefString}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(n){const u=o.getSheetBySheetId(n);return u?{type:"sheet",name:u.getName()}:{type:"sheet-error",name:this._localeService.t("hyperLink.message.refError")}}return null}navigateTo(t){const{gid:n,range:e,rangeid:r}=t,o=this._univerInstanceService.getCurrentUnitForType(l.UniverInstanceType.UNIVER_SHEET);if(!o)return;const a=o.getUnitId();if(r&&this.navigateToDefineName(a,r),!!n){if(e){const c=H.deserializeRangeWithSheet(e);l.isValidRange(c.range)&&e!==ve&&this.navigateToRange(a,n,c.range);return}this.navigateToSheetById(a,n)}}parseHyperLink(t){var n,e,r;if(t!=null&&t.startsWith("#")){const o=new URLSearchParams(t.slice(1)),a={gid:(n=o.get("gid"))!=null?n:"",range:(e=o.get("range"))!=null?e:"",rangeid:(r=o.get("rangeid"))!=null?r:""},c=this._getURLName(a);return{type:(c==null?void 0:c.type)||"link",name:(c==null?void 0:c.name)||t,url:t,searchObj:a,handler:()=>{this.navigateTo(a)}}}else return{type:"outer",name:t,url:t,handler:()=>{this.navigateToOtherWebsite(t)}}}async navigateToRange(t,n,e){const r=await this.navigateToSheetById(t,n);if(r){const o=Ge(e,r.getMergeData());await this._commandService.executeCommand(p.SetSelectionsOperation.id,{unitId:t,subUnitId:n,pluginName:p.NORMAL_SELECTION_PLUGIN_NAME,selections:[{range:o}]}),await this._commandService.executeCommand(_.ScrollToCellCommand.id,{range:o})}}async navigateToSheet(t,n){const e=this._univerInstanceService.getUnit(t,l.UniverInstanceType.UNIVER_SHEET);if(!e)return!1;const r=e.getActiveSheet();if((r==null?void 0:r.getName())===n)return!0;const o=e.getSheetBySheetName(n);if(!o){this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error});return}const a=o.getSheetId();return e.getHiddenWorksheets().indexOf(a)>-1&&this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:t,subUnitId:a})}async navigateToSheetById(t,n){const e=this._univerInstanceService.getUnit(t,l.UniverInstanceType.UNIVER_SHEET);if(!e)return!1;const r=e.getActiveSheet();if(r.getSheetId()===n)return r;const o=e.getSheetBySheetId(n);return o?e.getHiddenWorksheets().indexOf(n)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),!1):await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:t,subUnitId:n})?o:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error}),!1)}async navigateToDefineName(t,n){return this._definedNamesService.focusRange(t,n),!0}async navigateToOtherWebsite(t){window.open(t,"_blank","noopener noreferrer")}},s.SheetsHyperLinkResolverService=Ke([X(0,l.IUniverInstanceService),X(1,l.ICommandService),X(2,H.IDefinedNamesService),X(3,M.IMessageService),X(4,S.Inject(l.LocaleService))],s.SheetsHyperLinkResolverService);var Xe=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Qe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Je(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Xe(t,n,r),r},te=(i,t)=>(n,e)=>t(n,e,i);s.SheetsHyperLinkRefRangeController=class extends l.Disposable{constructor(n,e,r,o){super();V(this,"_disposableMap",new Map);V(this,"_rangeDisableMap",new Map);this._refRangeService=n,this._hyperLinkModel=e,this._resolverService=r,this._univerInstanceService=o,this._initData(),this._initRefRange()}_register(n,e,r){const o=r.id,a={startColumn:r.column,endColumn:r.column,startRow:r.row,endRow:r.row},c=d=>{const u=p.handleDefaultRangeChangeWithEffectRefCommands(a,d);return u&&u.startColumn===a.startColumn&&u.startRow===a.startRow?{undos:[],redos:[]}:u?{redos:[{id:v.UpdateHyperLinkRefMutation.id,params:{unitId:n,subUnitId:e,id:r.id,row:u.startRow,column:u.startColumn}}],undos:[{id:v.UpdateHyperLinkRefMutation.id,params:{unitId:n,subUnitId:e,id:r.id,row:a.startRow,column:a.startColumn}}]}:{redos:[{id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:e,id:r.id}}],undos:[{id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:e,link:r}}]}};this._disposableMap.set(o,this._refRangeService.registerRefRange(a,c,n,e))}_unregister(n){const e=this._disposableMap.get(n);e==null||e.dispose(),this._disposableMap.delete(n)}_registerRange(n,e,r){const o=this._resolverService.parseHyperLink(r);if(o.searchObj&&o.searchObj.range&&o.searchObj.gid){const a=o.searchObj.gid,c=H.deserializeRangeWithSheet(o.searchObj.range).range;if(l.isValidRange(c)&&o.searchObj.range!==ve){const d=u=>{const m=p.handleDefaultRangeChangeWithEffectRefCommands(c,u);return m&&H.serializeRange(m)===H.serializeRange(c)?{redos:[],undos:[]}:{redos:[{id:v.UpdateHyperLinkMutation.id,params:{unitId:n,subUnitId:a,id:e,payload:{payload:`#gid=${a}&range=${m?H.serializeRange(m):"err"}`}}}],undos:[{id:v.UpdateHyperLinkMutation.id,params:{unitId:n,subUnitId:a,id:e,payload:{payload:r}}}]}};this._rangeDisableMap.set(e,this._refRangeService.registerRefRange(c,d,n,a))}}}_unregisterRange(n){const e=this._rangeDisableMap.get(n);e==null||e.dispose(),this._rangeDisableMap.delete(n)}_initData(){this._hyperLinkModel.getAll().forEach(e=>{e.forEach(r=>{const{unitId:o,subUnitId:a,links:c}=r;c.forEach(d=>{this._register(o,a,d)})})})}_initRefRange(){this.disposeWithMe(this._hyperLinkModel.linkUpdate$.subscribe(n=>{switch(n.type){case"add":{this._register(n.unitId,n.subUnitId,n.payload),this._registerRange(n.unitId,n.payload.id,n.payload.payload);break}case"remove":{this._unregister(n.payload.id),this._unregisterRange(n.payload.id);break}case"updateRef":{const{unitId:e,subUnitId:r,id:o}=n,a=this._hyperLinkModel.getHyperLink(e,r,o);if(!a)return;this._unregister(o),this._register(e,r,a);break}case"unload":{const{unitLinks:e}=n;e.forEach(r=>{const{links:o}=r;o.forEach(a=>{this._unregister(a.id),this._unregisterRange(a.id)})});break}case"update":{this._unregisterRange(n.id),this._registerRange(n.unitId,n.id,n.payload.payload);break}}})),this.disposeWithMe(l.toDisposable(()=>{this._disposableMap.forEach(n=>{n.dispose()}),this._disposableMap.clear()}))}},s.SheetsHyperLinkRefRangeController=Qe([l.OnLifecycle(l.LifecycleStages.Starting,s.SheetsHyperLinkRefRangeController),te(0,S.Inject(p.RefRangeService)),te(1,S.Inject(v.HyperLinkModel)),te(2,S.Inject(s.SheetsHyperLinkResolverService)),te(3,l.IUniverInstanceService)],s.SheetsHyperLinkRefRangeController);var qe=Object.defineProperty,en=Object.getOwnPropertyDescriptor,ke=(i,t,n,e)=>{for(var r=e>1?void 0:e?en(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&qe(t,n,r),r},z=(i,t)=>(n,e)=>t(n,e,i);s.SheetsHyperLinkRenderController=class extends l.Disposable{constructor(t,n,e,r){super(),this._context=t,this._hyperLinkModel=n,this._sheetSkeletonManagerService=e,this._renderManagerService=r,this._initSkeletonChange()}_initSkeletonChange(){const t=()=>{const n=this._context.unit,e=n.getUnitId(),r=n.getActiveSheet().getSheetId(),o=this._sheetSkeletonManagerService.getOrCreateSkeleton({sheetId:r}),a=this._renderManagerService.getRenderById(e);o==null||o.makeDirty(!0),o==null||o.calculate(),a&&a.mainComponent.makeForceDirty()};this.disposeWithMe(this._hyperLinkModel.linkUpdate$.subscribe(()=>{t()}))}},s.SheetsHyperLinkRenderController=ke([z(1,S.Inject(v.HyperLinkModel)),z(2,S.Inject(_.SheetSkeletonManagerService)),z(3,Ce.IRenderManagerService)],s.SheetsHyperLinkRenderController),s.SheetsHyperLinkRenderManagerController=class extends l.Disposable{constructor(t,n,e){super(),this._sheetInterceptorService=t,this._hyperLinkModel=n,this._themeService=e,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(t,n,e)=>{const{row:r,col:o,unitId:a,subUnitId:c}=n,d=this._hyperLinkModel.getHyperLinkByLocation(a,c,r,o),u=this._themeService.getCurrentTheme();return e(d?{...t,interceptorStyle:{ul:{s:l.BooleanNumber.TRUE},cl:{rgb:u.blue500}}}:t)},priority:100}))}},s.SheetsHyperLinkRenderManagerController=ke([l.OnLifecycle(l.LifecycleStages.Ready,s.SheetsHyperLinkRenderManagerController),z(0,S.Inject(p.SheetInterceptorService)),z(1,S.Inject(v.HyperLinkModel)),z(2,S.Inject(l.ThemeService))],s.SheetsHyperLinkRenderManagerController);var Ie={exports:{}},re={};/**
|
|
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 qe=C,et=Symbol.for("react.element"),tt=Symbol.for("react.fragment"),nt=Object.prototype.hasOwnProperty,rt=qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,it={key:!0,ref:!0,__self:!0,__source:!0};function Ie(i,n,t){var e,r={},o=null,a=null;t!==void 0&&(o=""+t),n.key!==void 0&&(o=""+n.key),n.ref!==void 0&&(a=n.ref);for(e in n)nt.call(n,e)&&!it.hasOwnProperty(e)&&(r[e]=n[e]);if(i&&i.defaultProps)for(e in n=i.defaultProps,n)r[e]===void 0&&(r[e]=n[e]);return{$$typeof:et,type:i,key:o,ref:a,props:r,_owner:rt.current}}re.Fragment=tt,re.jsx=Ie,re.jsxs=Ie,ke.exports=re;var m=ke.exports,N=function(){return N=Object.assign||function(i){for(var n,t=1,e=arguments.length;t<e;t++){n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(i[r]=n[r])}return i},N.apply(this,arguments)},ot=function(i,n){var t={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&n.indexOf(e)<0&&(t[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(i);r<e.length;r++)n.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(i,e[r])&&(t[e[r]]=i[e[r]]);return t},$=C.forwardRef(function(i,n){var t=i.icon,e=i.id,r=i.className,o=i.extend,a=ot(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),d=C.useRef("_".concat(lt()));return Re(t,"".concat(e),{defIds:t.defIds,idSuffix:d.current},N({ref:n,className:c},a),o)});function Re(i,n,t,e,r){return C.createElement(i.tag,N(N({key:n},at(i,t,r)),e),(st(i,t).children||[]).map(function(o,a){return Re(o,"".concat(n,"-").concat(i.tag,"-").concat(a),t,void 0,r)}))}function at(i,n,t){var e=N({},i.attrs);t!=null&&t.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=t.colorChannel1);var r=n.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+n.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],c=o[1];typeof c=="string"&&(e[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),e}function st(i,n){var t,e=n.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((t=i.children)===null||t===void 0)&&t.length)?N(N({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?N(N({},r),{attrs:N(N({},r.attrs),{id:r.attrs.id+n.idSuffix})}):r})}):i}function lt(){return Math.random().toString(36).substring(2,8)}$.displayName="UniverIcon";var ct={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"}}]},Pe=C.forwardRef(function(i,n){return C.createElement($,Object.assign({},i,{id:"all-border-single",ref:n,icon:ct}))});Pe.displayName="AllBorderSingle";const ge=Pe;var dt={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,n){return C.createElement($,Object.assign({},i,{id:"copy-single",ref:n,icon:dt}))});be.displayName="CopySingle";const ut=be;var pt={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"}}]},ie=C.forwardRef(function(i,n){return C.createElement($,Object.assign({},i,{id:"link-single",ref:n,icon:pt}))});ie.displayName="LinkSingle";var ht={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,n){return C.createElement($,Object.assign({},i,{id:"unlink-single",ref:n,icon:ht}))});Oe.displayName="UnlinkSingle";const vt=Oe;var mt={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,n){return C.createElement($,Object.assign({},i,{id:"write-single",ref:n,icon:mt}))});Me.displayName="WriteSingle";const gt=Me;var St={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"}}]},Ee=C.forwardRef(function(i,n){return C.createElement($,Object.assign({},i,{id:"xlsx",ref:n,icon:St}))});Ee.displayName="Xlsx";const He=Ee,ft=/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi,yt=new RegExp(ft);function J(i){return i.startsWith("http://localhost:3002")||i.startsWith("localhost:3002")?!0:!!i.match(yt)}function we(i){return/^[a-zA-Z]+:\/\//.test(i)}function _t(i){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(i)}function je(i){return J(i)?we(i)?i:_t(i)?`mailto://${i}`:`http://${i}`:i}const Ct={cellLinkEditButtons:"univer-cell-link-edit-buttons"};function Lt(i){if(i===null)return"";if(i!=null&&i.p){const n=i==null?void 0:i.p.body;if(n==null)return"";const t=n.dataStream;return t.substring(t.length-2,t.length)===s.DEFAULT_EMPTY_DOCUMENT_VALUE?t.substring(0,t.length-2):t}return i==null?void 0:i.v}const oe=()=>{var ue;const[i,n]=C.useState(""),[t,e]=C.useState(""),[r,o]=C.useState("link"),[a,c]=C.useState(""),d=w.useDependency(s.LocaleService),u=w.useDependency(H.IDefinedNamesService),g=w.useDependency(s.IUniverInstanceService),y=w.useDependency(l.SheetsHyperLinkPopupService),h=O.useObservable(y.currentEditing$),P=w.useDependency(v.HyperLinkModel),b=w.useDependency(l.SheetsHyperLinkResolverService),R=w.useDependency(s.ICommandService),[E,j]=C.useState(!1),L=C.useRef(!1);C.useEffect(()=>{var f,k,M;if((h==null?void 0:h.row)!==void 0&&h.column!==void 0){const U=P.getHyperLinkByLocation(h.unitId,h.subUnitId,h.row,h.column);if(U){const Ce=b.parseHyperLink(U.payload);if(n(U.id),e(U.display),Ce.type==="outer"){o("link"),c(Ce.url);return}else{const x=Ce.searchObj;if(x.rangeid){o("rangeid"),c(x.rangeid);return}if(x.range){const nn=x.gid&&(M=(k=(f=g.getUnit(h.unitId))==null?void 0:f.getSheetBySheetId(x.gid))==null?void 0:k.getName())!=null?M:"";o("range"),c(H.serializeRangeWithSheet(nn,H.deserializeRangeWithSheet(x.range).range));return}if(x.gid){o("gid"),c(x.gid);return}}}const G=g.getUnit(h.unitId),W=G==null?void 0:G.getSheetBySheetId(h.subUnitId),tn=W==null?void 0:W.getCellRaw(h.row,h.column),_e=Lt(tn);o("link"),c(""),e((_e!=null?_e:"").toString()),n("");return}o("link"),c(""),e(""),n("")},[h,P,b,g]);const D=C.useMemo(()=>a,[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"}],T=g.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!T)return;const K=T.getHiddenWorksheets(),B=T.getSheets().map(f=>({label:f.getName(),value:f.getSheetId()})).filter(f=>K.indexOf(f.value)===-1),F=Object.values((ue=u.getDefinedNameMap(T.getUnitId()))!=null?ue:{}).map(f=>({label:f.name,value:f.id})),te=(f,k)=>{if(f==="link")return we(k)?k:`http://${k}`;if(f==="range"){const M=H.deserializeRangeWithSheet(k),U=T.getSheetBySheetName(M.sheetName);if(U)return`#gid=${U.getSheetId()}&range=${H.serializeRange(M.range)}`}return`#${f}=${k}`},ye=async()=>{h&&(i?await R.executeCommand(v.UpdateHyperLinkCommand.id,{unitId:h.unitId,subUnitId:h.subUnitId,id:i,payload:{display:t,payload:te(r,a)}}):await R.executeCommand(v.AddHyperLinkCommand.id,{unitId:h.unitId,subUnitId:h.subUnitId,link:{id:s.Tools.generateRandomId(),row:h.row,column:h.column,payload:te(r,a),display:t}})),h&&(await R.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:h.unitId,subUnitId:h.subUnitId}),await R.executeCommand(_.ScrollToCellCommand.id,{range:{startRow:h.row,endRow:h.row,startColumn:h.column,endColumn:h.column}})),R.executeCommand(Q.id)};return m.jsxs("div",{children:[m.jsx(I.FormLayout,{label:d.t("hyperLink.form.label"),error:E&&!t?d.t("hyperLink.form.inputError"):"",children:m.jsx(I.Input,{value:t,onChange:f=>{e(f),L.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:f=>{o(f),c("")}})}),r==="link"&&m.jsx(I.FormLayout,{error:E?a?J(a)?"":d.t("hyperLink.form.linkError"):d.t("hyperLink.form.inputError"):"",children:m.jsx(I.Input,{value:a,onChange:f=>{c(f),f&&(L.current||!t)&&(e(f),L.current=!0)},placeholder:d.t("hyperLink.form.linkPlaceholder")})}),r==="range"&&m.jsx(I.FormLayout,{error:E&&!a?d.t("hyperLink.form.inputError"):"",children:m.jsx(O.RangeSelector,{openForSheetUnitId:T.getUnitId(),id:s.createInternalEditorID("hyper-link-edit"),isSingleChoice:!0,value:D,onChange:f=>{const k=f[0];if(!k||!s.isValidRange(k.range))return;k.sheetName||(k.sheetName=T.getActiveSheet().getName());const M=H.serializeRangeToRefString(k);c(M),M&&(L.current||!t)&&(e(M),L.current=!0)}})}),r==="gid"&&m.jsx(I.FormLayout,{error:E&&!a?d.t("hyperLink.form.selectError"):"",children:m.jsx(I.Select,{options:B,value:a,onChange:f=>{var M;c(f);const k=(M=B.find(U=>U.value===f))==null?void 0:M.label;k&&(L.current||!t)&&(e(k),L.current=!0)}})}),r==="rangeid"&&m.jsx(I.FormLayout,{error:E&&!a?d.t("hyperLink.form.selectError"):"",children:m.jsx(I.Select,{options:F,value:a,onChange:f=>{var M;c(f);const k=(M=F.find(U=>U.value===f))==null?void 0:M.label;k&&(L.current||!t)&&(e(k),L.current=!0)}})}),m.jsxs("div",{className:Ct.cellLinkEditButtons,children:[m.jsx(I.Button,{onClick:()=>{h&&R.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:h.unitId,subUnitId:h.subUnitId}),R.executeCommand(Q.id)},children:d.t("hyperLink.form.cancel")}),m.jsx(I.Button,{type:"primary",style:{marginLeft:8},onClick:async()=>{if(!t||!a||r==="link"&&!J(a)){j(!0);return}ye()},children:d.t("hyperLink.form.ok")})]})]})};oe.componentKey="univer.sheet.cell-link-edit";const ae={type:s.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-sidebar",handler(i,n){if(!n)return!1;const{unitId:t,subUnitId:e,row:r,column:o}=n,a=i.get(v.HyperLinkModel),c=i.get(O.ISidebarService),d=i.get(l.SheetsHyperLinkPopupService),u=a.getHyperLinkByLocation(t,e,r,o);return d.startEditing(n),c.open({header:{title:u?"hyperLink.form.editTitle":"hyperLink.form.addTitle"},children:{label:oe.componentKey}}),!0}},Q={type:s.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-sidebar",handler(i){const n=i.get(O.ISidebarService),t=i.get(l.SheetsHyperLinkPopupService);return n.close(),t.endEditing(),!0}},q={type:s.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(i){const n=i.get(s.IUniverInstanceService),t=p.getSheetCommandTarget(n);if(!t)return!1;const e=i.get(s.ICommandService),o=i.get(p.SelectionManagerService).getFirst();if(!(o!=null&&o.primary))return!1;const a=o.primary.actualRow,c=o.primary.actualColumn;return e.executeCommand(ae.id,{unitId:t.unitId,subUnitId:t.subUnitId,row:a,column:c})}},Te={type:s.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(i){const n=i.get(s.ICommandService);return i.get(l.SheetsHyperLinkPopupService).currentEditing?n.executeCommand(Q.id):n.executeCommand(q.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"},kt={outer:m.jsx(ie,{}),link:m.jsx(ie,{}),sheet:m.jsx(He,{}),range:m.jsx(ge,{}),defineName:m.jsx(ge,{}),"range-error":m.jsx(ge,{}),"sheet-error":m.jsx(He,{})},se=()=>{const i=w.useDependency(l.SheetsHyperLinkPopupService),n=w.useDependency(v.HyperLinkModel),t=w.useDependency(s.ICommandService),e=w.useDependency(O.IMessageService),r=w.useDependency(s.LocaleService),o=w.useObservable(i.currentPopup$,i.currentPopup),a=w.useDependency(l.SheetsHyperLinkResolverService);if(!o)return null;const{unitId:c,subUnitId:d,id:u}=o,g=n.getHyperLink(c,d,u);if(!g)return null;const y=a.parseHyperLink(g.payload),h=y.type.indexOf("error")>-1;return m.jsxs("div",{className:V.cellLink,onClick:()=>i.hideCurrentPopup(),children:[m.jsxs("div",{className:Le(V.cellLinkContent,{[V.cellLinkContentError]:h}),onClick:y.handler,children:[m.jsx("div",{className:V.cellLinkType,children:kt[y.type]}),m.jsx("div",{className:V.cellLinkUrl,children:y.name})]}),m.jsxs("div",{className:V.cellLinkOperations,children:[m.jsx("div",{className:Le(V.cellLinkOperation,{[V.cellLinkOperationError]:h}),onClick:()=>{if(!h){if(y.type!=="outer"){const P=new URL(window.location.href);P.hash=y.url.slice(1),navigator.clipboard.writeText(P.href)}else navigator.clipboard.writeText(y.url);e.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(ut,{})})}),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(gt,{})})}),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(vt,{})})})]})]})};se.componentKey="univer.sheet.cell-link-popup";var It=Object.defineProperty,Rt=Object.getOwnPropertyDescriptor,Pt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Rt(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&It(n,t,r),r},Ue=(i,n)=>(t,e)=>n(t,e,i);l.SheetsHyperLinkPopupService=class{constructor(n,t){A(this,"_currentPopup",null);A(this,"_currentPopup$",new pe.Subject);A(this,"currentPopup$",this._currentPopup$.asObservable());A(this,"_currentEditing$",new pe.BehaviorSubject(null));A(this,"currentEditing$",this._currentEditing$.asObservable());this._hyperLinkModel=n,this._sheetCanvasPopManagerService=t}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}showPopup(n){this.hideCurrentPopup();const{unitId:t,subUnitId:e,row:r,col:o}=n,a=this._hyperLinkModel.getHyperLinkByLocation(t,e,r,o);if(!a)return;const c=this._sheetCanvasPopManagerService.attachPopupToCell(r,o,{componentKey:se.componentKey,direction:"bottom",closeOnSelfTarget:!0});c&&(this._currentPopup={unitId:t,subUnitId:e,id:a.id,disposable:c},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(){var n;this._currentPopup&&((n=this._currentPopup.disposable)==null||n.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}startEditing(n){this._currentEditing$.next(n)}endEditing(){this._currentEditing$.next(null)}},l.SheetsHyperLinkPopupService=Pt([Ue(0,S.Inject(v.HyperLinkModel)),Ue(1,S.Inject(_.SheetCanvasPopManagerService))],l.SheetsHyperLinkPopupService);var bt=Object.defineProperty,Ot=Object.getOwnPropertyDescriptor,Mt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Ot(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&bt(n,t,r),r},ee=(i,n)=>(t,e)=>n(t,e,i);l.SheetHyperLinkSetRangeController=class extends s.Disposable{constructor(n,t,e,r,o){super(),this._sheetInterceptorService=n,this._injector=t,this._hyperLinkModel=e,this._selectionManagerService=r,this._univerInstanceService=o,this._initCommandInterceptor()}_initCommandInterceptor(){this._initAddHyperLinkCommandInterceptor(),this._initSetRangeValuesCommandInterceptor(),this._initUpdateHyperLinkCommandInterceptor(),this._initClearSelectionCommandInterceptor()}_initAddHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:n=>{if(n.id===v.AddHyperLinkCommand.id){const t=n.params,{unitId:e,subUnitId:r,link:o}=t,a={unitId:e,subUnitId:r,cellValue:{[o.row]:{[o.column]:{v:o.display,t:s.CellValueType.STRING,p:null}}}};return{redos:[{id:p.SetRangeValuesMutation.id,params:a}],undos:[{id:p.SetRangeValuesMutation.id,params:p.SetRangeValuesUndoMutationFactory(this._injector,a)}]}}return{redos:[],undos:[]}}}))}_initUpdateHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:n=>{if(n.id===v.UpdateHyperLinkCommand.id){const t=n.params,{unitId:e,subUnitId:r,id:o,payload:a}=t,c=this._hyperLinkModel.getHyperLink(e,r,o);if(c&&c.display!==a.display){const d={unitId:e,subUnitId:r,cellValue:{[c.row]:{[c.column]:{v:a.display,t:s.CellValueType.STRING,p:null}}}};return{redos:[{id:p.SetRangeValuesMutation.id,params:d}],undos:[{id:p.SetRangeValuesMutation.id,params:p.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}}return{redos:[],undos:[]}}}))}_initSetRangeValuesCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:n=>{if(n.id===p.SetRangeValuesCommand.id){const t=n.params,{unitId:e,subUnitId:r}=t,o=[],a=[];return t.cellValue&&new s.ObjectMatrix(t.cellValue).forValue((c,d,u)=>{var b,R,E,j;const g=((j=(E=u==null?void 0:u.v)!=null?E:(R=(b=u==null?void 0:u.p)==null?void 0:b.body)==null?void 0:R.dataStream.slice(0,-2))!=null?j:"").toString(),y=this._hyperLinkModel.getHyperLinkByLocation(e,r,c,d);if(!y){if(J(g)){const L=s.Tools.generateRandomId();a.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:e,subUnitId:r,id:L}}),o.push({id:v.AddHyperLinkMutation.id,params:{unitId:e,subUnitId:r,link:{id:L,row:c,column:d,display:g,payload:je(g)}}})}return}if(y.display===g)return;g||(o.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:e,subUnitId:r,id:y.id}}),a.push({id:v.AddHyperLinkMutation.id,params:{unitId:e,subUnitId:r,link:y}}));const h={unitId:e,subUnitId:r,id:y.id,payload:{payload:y.payload,display:g}},P={unitId:e,subUnitId:r,id:y.id,payload:{payload:y.payload,display:y.display}};o.push({id:v.UpdateHyperLinkMutation.id,params:h}),a.push({id:v.UpdateHyperLinkMutation.id,params:P})}),{undos:a,redos:o}}return{redos:[],undos:[]}}}))}_initClearSelectionCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:n=>{if(n.id===p.ClearSelectionContentCommand.id||n.id===p.ClearSelectionAllCommand.id){const t=[],e=[],r=this._selectionManagerService.getFirst(),o=p.getSheetCommandTarget(this._univerInstanceService);if(r&&o){const{unitId:a,subUnitId:c}=o;s.Range.foreach(r.range,(d,u)=>{const g=this._hyperLinkModel.getHyperLinkByLocation(a,c,d,u);g&&(t.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:a,subUnitId:c,id:g.id}}),e.push({id:v.AddHyperLinkMutation.id,params:{unitId:a,subUnitId:c,link:g}}))})}return{redos:t,undos:e}}return{redos:[],undos:[]}}}))}},l.SheetHyperLinkSetRangeController=Mt([s.OnLifecycle(s.LifecycleStages.Starting,l.SheetHyperLinkSetRangeController),ee(0,S.Inject(p.SheetInterceptorService)),ee(1,S.Inject(S.Injector)),ee(2,S.Inject(v.HyperLinkModel)),ee(3,S.Inject(p.SelectionManagerService)),ee(4,s.IUniverInstanceService)],l.SheetHyperLinkSetRangeController);var Et=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,wt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Ht(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&Et(n,t,r),r},Ne=(i,n)=>(t,e)=>n(t,e,i);l.SheetsHyperLinkPopupController=class extends s.Disposable{constructor(n,t){super(),this._hoverManagerService=n,this._sheetsHyperLinkPopupService=t,this._initHoverListener()}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(pe.debounceTime(100)).subscribe(n=>{if(!n){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}this._sheetsHyperLinkPopupService.showPopup(n.location)}))}},l.SheetsHyperLinkPopupController=wt([s.OnLifecycle(s.LifecycleStages.Rendered,l.SheetsHyperLinkPopupController),Ne(0,S.Inject(_.HoverManagerService)),Ne(1,S.Inject(l.SheetsHyperLinkPopupService))],l.SheetsHyperLinkPopupController);const jt=i=>({id:q.id,type:O.MenuItemType.BUTTON,positions:[O.MenuPosition.CONTEXT_MENU],title:"hyperLink.menu.add",hidden$:O.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET),icon:"LinkSingle",disabled$:_.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookEditablePermission],worksheetTypes:[p.WorksheetEditPermission,p.WorksheetSetCellValuePermission,p.WorksheetInsertHyperlinkPermission],rangeTypes:[p.RangeProtectionPermissionEditPoint]})}),Tt=i=>({tooltip:"hyperLink.form.addTitle",positions:O.MenuPosition.TOOLBAR_START,group:O.MenuGroup.TOOLBAR_OTHERS,id:Te.id,type:O.MenuItemType.BUTTON,icon:"LinkSingle",hidden$:O.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET),disabled$:_.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookEditablePermission],worksheetTypes:[p.WorksheetEditPermission,p.WorksheetSetCellValuePermission,p.WorksheetInsertHyperlinkPermission],rangeTypes:[p.RangeProtectionPermissionEditPoint]})}),Se={id:q.id,binding:O.KeyCode.K|O.MetaKeys.CTRL_COMMAND,preconditions:_.whenSheetEditorFocused};var Ut=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,Dt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Nt(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&Ut(n,t,r),r},Y=(i,n)=>(t,e)=>n(t,e,i);l.SheetsHyperLinkUIController=class extends s.Disposable{constructor(n,t,e,r,o,a,c){super(),this._config=n,this._componentManager=t,this._commandService=e,this._localeService=r,this._menuService=o,this._injector=a,this._shortcutService=c,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[se,se.componentKey],[oe,oe.componentKey],[ie,"LinkSingle"]].forEach(([n,t])=>{this._componentManager.register(t,n)})}_initCommands(){[ae,Q,q,Te].forEach(n=>{this._commandService.registerCommand(n)})}_initMenus(){var n,t,e,r;this._menuService.addMenuItem(jt(this._injector),(t=(n=this._config)==null?void 0:n.menu)!=null?t:{}),this._menuService.addMenuItem(Tt(this._injector),(r=(e=this._config)==null?void 0:e.menu)!=null?r:{})}_initShortCut(){this._shortcutService.registerShortcut(Se)}},l.SheetsHyperLinkUIController=Dt([s.OnLifecycle(s.LifecycleStages.Ready,l.SheetsHyperLinkUIController),Y(1,S.Inject(O.ComponentManager)),Y(2,s.ICommandService),Y(3,S.Inject(s.LocaleService)),Y(4,O.IMenuService),Y(5,S.Inject(S.Injector)),Y(6,S.Inject(O.IShortcutService))],l.SheetsHyperLinkUIController);var At=Object.defineProperty,Vt=Object.getOwnPropertyDescriptor,Wt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Vt(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&At(n,t,r),r},De=(i,n)=>(t,e)=>n(t,e,i);l.SheetsHyperLinkAutoFillController=class extends s.Disposable{constructor(n,t){super(),this._autoFillService=n,this._hyperLinkModel=t,this._initAutoFill()}_initAutoFill(){const n=()=>({redos:[],undos:[]}),t=(r,o)=>{const{source:a,target:c,unitId:d,subUnitId:u}=r,g=_.virtualizeDiscreteRanges([a,c]),[y,h]=g.ranges,{mapFunc:P}=g,b={row:y.startRow,col:y.startColumn},R=_.getAutoFillRepeatRange(y,h),E=[],j=[];return R.forEach(L=>{const D=L.repeatStartCell,Z=L.relativeRange,T={startRow:b.row,startColumn:b.col,endColumn:b.col,endRow:b.row},K={startRow:D.row,startColumn:D.col,endColumn:D.col,endRow:D.row};s.Range.foreach(Z,(B,F)=>{const te=s.Rectangle.getPositionRange({startRow:B,startColumn:F,endColumn:F,endRow:B},T),{row:ye,col:ue}=P(te.startRow,te.startColumn),f=this._hyperLinkModel.getHyperLinkByLocation(d,u,ye,ue);if(f){const k=s.Rectangle.getPositionRange({startRow:B,startColumn:F,endColumn:F,endRow:B},K),{row:M,col:U}=P(k.startRow,k.startColumn),G=s.Tools.generateRandomId(),W=this._hyperLinkModel.getHyperLinkByLocation(d,u,M,U);W&&E.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:u,id:W.id}}),_.APPLY_TYPE.COPY===o&&(E.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:u,link:{...f,id:G,row:M,column:U}}}),j.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:u,id:G}})),W&&j.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:u,link:W}})}})}),{undos:j,redos:E}},e={id:ve,onFillData:(r,o,a)=>a===_.APPLY_TYPE.COPY||a===_.APPLY_TYPE.ONLY_FORMAT||a===_.APPLY_TYPE.SERIES?t(r,a):n()};this.disposeWithMe(this._autoFillService.addHook(e))}},l.SheetsHyperLinkAutoFillController=Wt([s.OnLifecycle(s.LifecycleStages.Ready,l.SheetsHyperLinkAutoFillController),De(0,_.IAutoFillService),De(1,S.Inject(v.HyperLinkModel))],l.SheetsHyperLinkAutoFillController);var xt=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,Bt=(i,n,t,e)=>{for(var r=e>1?void 0:e?$t(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&xt(n,t,r),r},le=(i,n)=>(t,e)=>n(t,e,i);l.SheetsHyperLinkCopyPasteController=class extends s.Disposable{constructor(t,e,r,o){super();A(this,"_copyInfo");this._sheetClipboardService=t,this._hyperLinkModel=e,this._injector=r,this._resolverService=o,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:ve,onBeforeCopy:(t,e,r)=>this._collect(t,e,r),onPasteCells:(t,e,r,o)=>{const{copyType:a=_.COPY_TYPE.COPY,pasteType:c}=o,{range:d}=t||{},{range:u,unitId:g,subUnitId:y}=e;return this._generateMutations(u,{copyType:a,pasteType:c,copyRange:d,unitId:g,subUnitId:y})},onPastePlainText:(t,e)=>{if(J(e)){let r=je(e);const o=new URL(r),a=e;o.hostname===location.hostname&&o.port===location.port&&o.protocol===location.protocol&&o.pathname===location.pathname&&o.hash&&(r=o.hash);const{range:c,unitId:d,subUnitId:u}=t,{ranges:[g],mapFunc:y}=_.virtualizeDiscreteRanges([c]),h=[],P=[];return s.Range.foreach(g,(b,R)=>{const{row:E,col:j}=y(b,R),L=this._hyperLinkModel.getHyperLinkByLocation(d,u,E,j);L&&h.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:u,id:L.id}});const D=s.Tools.generateRandomId();h.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:u,link:{id:D,row:E,column:j,display:a,payload:r}}}),P.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:u,id:D}}),L&&P.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:u,link:L}})}),{redos:h,undos:P}}return{undos:[],redos:[]}}})}_collect(t,e,r){const o=new s.ObjectMatrix;this._copyInfo={unitId:t,subUnitId:e,matrix:o};const a={get:this._injector.get.bind(this._injector)},c=_.rangeToDiscreteRange(r,a,t,e);if(!c)return;const{rows:d,cols:u}=c;d.forEach((g,y)=>{u.forEach((h,P)=>{var R;const b=this._hyperLinkModel.getHyperLinkByLocation(t,e,g,h);o.setValue(y,P,(R=b==null?void 0:b.id)!=null?R:"")})})}_generateMutations(t,e){if(!this._copyInfo)return{redos:[],undos:[]};if(e.copyType===_.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!e.copyRange)return{redos:[],undos:[]};if([_.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,_.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,_.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,Ve.SPECIAL_PASTE_FORMULA].includes(e.pasteType))return{redos:[],undos:[]};const{unitId:r,subUnitId:o}=this._copyInfo,a=[],c=[],{ranges:[d,u],mapFunc:g}=_.virtualizeDiscreteRanges([e.copyRange,t]);return _.getRepeatRange(d,u,!0).forEach(({startRange:h})=>{var P;(P=this._copyInfo)==null||P.matrix.forValue((b,R,E)=>{const j=s.Rectangle.getPositionRange({startRow:b,endRow:b,startColumn:R,endColumn:R},h),L=this._hyperLinkModel.getHyperLink(r,o,E),{row:D,col:Z}=g(j.startRow,j.startColumn),T=this._hyperLinkModel.getHyperLinkByLocation(e.unitId,e.subUnitId,D,Z),K=s.Tools.generateRandomId();T&&a.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:e.unitId,subUnitId:e.subUnitId,id:T.id}}),L&&(a.push({id:v.AddHyperLinkMutation.id,params:{unitId:e.unitId,subUnitId:e.subUnitId,link:{...L,id:K,row:D,column:Z}}}),c.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:e.unitId,subUnitId:e.subUnitId,id:K}})),T&&c.push({id:v.AddHyperLinkMutation.id,params:{unitId:e.unitId,subUnitId:e.subUnitId,link:T}})})}),{redos:a,undos:c}}},l.SheetsHyperLinkCopyPasteController=Bt([s.OnLifecycle(s.LifecycleStages.Ready,l.SheetsHyperLinkCopyPasteController),le(0,_.ISheetClipboardService),le(1,S.Inject(v.HyperLinkModel)),le(2,S.Inject(S.Injector)),le(3,S.Inject(l.SheetsHyperLinkResolverService))],l.SheetsHyperLinkCopyPasteController);var Ft=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,Yt=(i,n,t,e)=>{for(var r=e>1?void 0:e?zt(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&Ft(n,t,r),r},Zt=(i,n)=>(t,e)=>n(t,e,i);l.SheetHyperLinkUrlController=class extends s.Disposable{constructor(n){super(),this._resolverService=n,this._handleInitUrl()}_handleInitUrl(){const n=location.hash;n&&this._resolverService.parseHyperLink(n).handler()}},l.SheetHyperLinkUrlController=Yt([s.OnLifecycle(s.LifecycleStages.Rendered,l.SheetHyperLinkUrlController),Zt(0,S.Inject(l.SheetsHyperLinkResolverService))],l.SheetHyperLinkUrlController);var Kt=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,Xt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Gt(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&Kt(n,t,r),r},fe=(i,n)=>(t,e)=>n(t,e,i);let ce=class extends s.Disposable{constructor(i,n,t){super(),this._localeService=i,this._commandService=n,this._sheetPermissionInterceptorBaseController=t,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(i=>{i.id===Se.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookEditablePermission],rangeTypes:[p.RangeProtectionPermissionEditPoint],worksheetTypes:[p.WorksheetEditPermission,p.WorksheetSetCellValuePermission,p.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")))}))}};ce=Xt([s.OnLifecycle(s.LifecycleStages.Rendered,ce),fe(0,S.Inject(s.LocaleService)),fe(1,s.ICommandService),fe(2,S.Inject(_.SheetPermissionInterceptorBaseController))],ce);var Jt=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,qt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Qt(n,t):n,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(n,t,r):a(r))||r);return e&&r&&Jt(n,t,r),r},en=(i,n)=>(t,e)=>n(t,e,i);l.UniverSheetsHyperLinkUIPlugin=(de=class extends v.UniverSheetsHyperLinkPlugin{constructor(n,t){super(n,t),this._config=n,this._injector=t}onStarting(n){super.onStarting(n),[[l.SheetsHyperLinkResolverService],[l.SheetsHyperLinkPopupService],[l.SheetsHyperLinkRemoveSheetController],[l.SheetsHyperLinkRefRangeController],[l.SheetsHyperLinkRenderController],[l.SheetHyperLinkSetRangeController],[l.SheetsHyperLinkPopupController],[l.SheetsHyperLinkUIController,{useFactory:()=>this._injector.createInstance(l.SheetsHyperLinkUIController,this._config)}],[l.SheetsHyperLinkAutoFillController],[l.SheetsHyperLinkCopyPasteController],[ce],[l.SheetHyperLinkUrlController]].forEach(e=>{n.add(e)})}},A(de,"pluginName",ve),A(de,"type",s.UniverInstanceType.UNIVER_SHEET),de),l.UniverSheetsHyperLinkUIPlugin=qt([en(1,S.Inject(S.Injector))],l.UniverSheetsHyperLinkUIPlugin),l.CloseHyperLinkSidebarOperation=Q,l.InsertHyperLinkOperation=q,l.InsertLinkShortcut=Se,l.OpenHyperLinkSidebarOperation=ae,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
9
|
+
*/var nn=C,tn=Symbol.for("react.element"),rn=Symbol.for("react.fragment"),on=Object.prototype.hasOwnProperty,an=nn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,sn={key:!0,ref:!0,__self:!0,__source:!0};function Re(i,t,n){var e,r={},o=null,a=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(a=t.ref);for(e in t)on.call(t,e)&&!sn.hasOwnProperty(e)&&(r[e]=t[e]);if(i&&i.defaultProps)for(e in t=i.defaultProps,t)r[e]===void 0&&(r[e]=t[e]);return{$$typeof:tn,type:i,key:o,ref:a,props:r,_owner:an.current}}re.Fragment=rn,re.jsx=Re,re.jsxs=Re,Ie.exports=re;var g=Ie.exports,N=function(){return N=Object.assign||function(i){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},N.apply(this,arguments)},ln=function(i,t){var n={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(i);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(i,e[r])&&(n[e[r]]=i[e[r]]);return n},x=C.forwardRef(function(i,t){var n=i.icon,e=i.id,r=i.className,o=i.extend,a=ln(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),d=C.useRef("_".concat(un()));return Pe(n,"".concat(e),{defIds:n.defIds,idSuffix:d.current},N({ref:t,className:c},a),o)});function Pe(i,t,n,e,r){return C.createElement(i.tag,N(N({key:t},cn(i,n,r)),e),(dn(i,n).children||[]).map(function(o,a){return Pe(o,"".concat(t,"-").concat(i.tag,"-").concat(a),n,void 0,r)}))}function cn(i,t,n){var e=N({},i.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],c=o[1];typeof c=="string"&&(e[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function dn(i,t){var n,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?N(N({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?N(N({},r),{attrs:N(N({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function un(){return Math.random().toString(36).substring(2,8)}x.displayName="UniverIcon";var pn={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"}}]},be=C.forwardRef(function(i,t){return C.createElement(x,Object.assign({},i,{id:"all-border-single",ref:t,icon:pn}))});be.displayName="AllBorderSingle";const ge=be;var hn={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"}}]},Me=C.forwardRef(function(i,t){return C.createElement(x,Object.assign({},i,{id:"copy-single",ref:t,icon:hn}))});Me.displayName="CopySingle";const vn=Me;var gn={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"}}]},ie=C.forwardRef(function(i,t){return C.createElement(x,Object.assign({},i,{id:"link-single",ref:t,icon:gn}))});ie.displayName="LinkSingle";var mn={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,t){return C.createElement(x,Object.assign({},i,{id:"unlink-single",ref:t,icon:mn}))});Oe.displayName="UnlinkSingle";const Sn=Oe;var fn={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"}}]},Ee=C.forwardRef(function(i,t){return C.createElement(x,Object.assign({},i,{id:"write-single",ref:t,icon:fn}))});Ee.displayName="WriteSingle";const yn=Ee;var _n={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"}}]},He=C.forwardRef(function(i,t){return C.createElement(x,Object.assign({},i,{id:"xlsx",ref:t,icon:_n}))});He.displayName="Xlsx";const we=He,Cn=/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi,Ln=new RegExp(Cn);function J(i){return i.startsWith("http://localhost:3002")||i.startsWith("localhost:3002")?!0:!!i.match(Ln)}function je(i){return/^[a-zA-Z]+:\/\//.test(i)}function kn(i){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(i)}function Te(i){return J(i)?je(i)?i:kn(i)?`mailto://${i}`:`http://${i}`:i}const In={cellLinkEditButtons:"univer-cell-link-edit-buttons"};function Rn(i){if(i===null)return"";if(i!=null&&i.p){const t=i==null?void 0:i.p.body;if(t==null)return"";const n=t.dataStream;return n.substring(n.length-2,n.length)===l.DEFAULT_EMPTY_DOCUMENT_VALUE?n.substring(0,n.length-2):n}return i==null?void 0:i.v}const oe=()=>{var de;const[i,t]=C.useState(""),[n,e]=C.useState(""),[r,o]=C.useState("link"),[a,c]=C.useState(""),d=w.useDependency(l.LocaleService),u=w.useDependency(H.IDefinedNamesService),m=w.useDependency(l.IUniverInstanceService),y=w.useDependency(s.SheetsHyperLinkPopupService),h=M.useObservable(y.currentEditing$),P=w.useDependency(v.HyperLinkModel),b=w.useDependency(s.SheetsHyperLinkResolverService),R=w.useDependency(l.ICommandService),[E,j]=C.useState(!1),L=C.useRef(!1);C.useEffect(()=>{var f,k,O;if((h==null?void 0:h.row)!==void 0&&h.column!==void 0){const U=P.getHyperLinkByLocation(h.unitId,h.subUnitId,h.row,h.column);if(U){const _e=b.parseHyperLink(U.payload);if(t(U.id),e(U.display),_e.type==="outer"){o("link"),c(_e.url);return}else{const $=_e.searchObj;if($.rangeid){o("rangeid"),c($.rangeid);return}if($.range){const it=$.gid&&(O=(k=(f=m.getUnit(h.unitId))==null?void 0:f.getSheetBySheetId($.gid))==null?void 0:k.getName())!=null?O:"";o("range"),c(H.serializeRangeWithSheet(it,H.deserializeRangeWithSheet($.range).range));return}if($.gid){o("gid"),c($.gid);return}}}const G=m.getUnit(h.unitId),W=G==null?void 0:G.getSheetBySheetId(h.subUnitId),rt=W==null?void 0:W.getCellRaw(h.row,h.column),ye=Rn(rt);o("link"),c(""),e((ye!=null?ye:"").toString()),t("");return}o("link"),c(""),e(""),t("")},[h,P,b,m]);const D=C.useMemo(()=>a,[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"}],T=m.getCurrentUnitForType(l.UniverInstanceType.UNIVER_SHEET);if(!T)return;const K=T.getHiddenWorksheets(),B=T.getSheets().map(f=>({label:f.getName(),value:f.getSheetId()})).filter(f=>K.indexOf(f.value)===-1),F=Object.values((de=u.getDefinedNameMap(T.getUnitId()))!=null?de:{}).map(f=>({label:f.name,value:f.id})),ne=(f,k)=>{if(f==="link")return je(k)?k:`http://${k}`;if(f==="range"){const O=H.deserializeRangeWithSheet(k),U=T.getSheetBySheetName(O.sheetName);if(U)return`#gid=${U.getSheetId()}&range=${H.serializeRange(O.range)}`}return`#${f}=${k}`},fe=async()=>{h&&(i?await R.executeCommand(v.UpdateHyperLinkCommand.id,{unitId:h.unitId,subUnitId:h.subUnitId,id:i,payload:{display:n,payload:ne(r,a)}}):await R.executeCommand(v.AddHyperLinkCommand.id,{unitId:h.unitId,subUnitId:h.subUnitId,link:{id:l.Tools.generateRandomId(),row:h.row,column:h.column,payload:ne(r,a),display:n}})),h&&(await R.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:h.unitId,subUnitId:h.subUnitId}),await R.executeCommand(_.ScrollToCellCommand.id,{range:{startRow:h.row,endRow:h.row,startColumn:h.column,endColumn:h.column}})),R.executeCommand(Q.id)};return g.jsxs("div",{children:[g.jsx(I.FormLayout,{label:d.t("hyperLink.form.label"),error:E&&!n?d.t("hyperLink.form.inputError"):"",children:g.jsx(I.Input,{value:n,onChange:f=>{e(f),L.current=!1},placeholder:d.t("hyperLink.form.labelPlaceholder")})}),g.jsx(I.FormLayout,{label:d.t("hyperLink.form.type"),children:g.jsx(I.Select,{options:Z,value:r,onChange:f=>{o(f),c("")}})}),r==="link"&&g.jsx(I.FormLayout,{error:E?a?J(a)?"":d.t("hyperLink.form.linkError"):d.t("hyperLink.form.inputError"):"",children:g.jsx(I.Input,{value:a,onChange:f=>{c(f),f&&(L.current||!n)&&(e(f),L.current=!0)},placeholder:d.t("hyperLink.form.linkPlaceholder")})}),r==="range"&&g.jsx(I.FormLayout,{error:E&&!a?d.t("hyperLink.form.inputError"):"",children:g.jsx(M.RangeSelector,{openForSheetUnitId:T.getUnitId(),id:l.createInternalEditorID("hyper-link-edit"),isSingleChoice:!0,value:D,onChange:f=>{const k=f[0];if(!k||!l.isValidRange(k.range))return;k.sheetName||(k.sheetName=T.getActiveSheet().getName());const O=H.serializeRangeToRefString(k);c(O),O&&(L.current||!n)&&(e(O),L.current=!0)}})}),r==="gid"&&g.jsx(I.FormLayout,{error:E&&!a?d.t("hyperLink.form.selectError"):"",children:g.jsx(I.Select,{options:B,value:a,onChange:f=>{var O;c(f);const k=(O=B.find(U=>U.value===f))==null?void 0:O.label;k&&(L.current||!n)&&(e(k),L.current=!0)}})}),r==="rangeid"&&g.jsx(I.FormLayout,{error:E&&!a?d.t("hyperLink.form.selectError"):"",children:g.jsx(I.Select,{options:F,value:a,onChange:f=>{var O;c(f);const k=(O=F.find(U=>U.value===f))==null?void 0:O.label;k&&(L.current||!n)&&(e(k),L.current=!0)}})}),g.jsxs("div",{className:In.cellLinkEditButtons,children:[g.jsx(I.Button,{onClick:()=>{h&&R.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:h.unitId,subUnitId:h.subUnitId}),R.executeCommand(Q.id)},children:d.t("hyperLink.form.cancel")}),g.jsx(I.Button,{type:"primary",style:{marginLeft:8},onClick:async()=>{if(!n||!a||r==="link"&&!J(a)){j(!0);return}fe()},children:d.t("hyperLink.form.ok")})]})]})};oe.componentKey="univer.sheet.cell-link-edit";const ae={type:l.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-sidebar",handler(i,t){if(!t)return!1;const{unitId:n,subUnitId:e,row:r,column:o}=t,a=i.get(v.HyperLinkModel),c=i.get(M.ISidebarService),d=i.get(s.SheetsHyperLinkPopupService),u=a.getHyperLinkByLocation(n,e,r,o);return d.startEditing(t),c.open({header:{title:u?"hyperLink.form.editTitle":"hyperLink.form.addTitle"},children:{label:oe.componentKey}}),!0}},Q={type:l.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-sidebar",handler(i){const t=i.get(M.ISidebarService),n=i.get(s.SheetsHyperLinkPopupService);return t.close(),n.endEditing(),!0}},q={type:l.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(i){const t=i.get(l.IUniverInstanceService),n=p.getSheetCommandTarget(t);if(!n)return!1;const e=i.get(l.ICommandService),o=i.get(p.SelectionManagerService).getFirst();if(!(o!=null&&o.primary))return!1;const a=o.primary.actualRow,c=o.primary.actualColumn;return e.executeCommand(ae.id,{unitId:n.unitId,subUnitId:n.subUnitId,row:a,column:c})}},Ue={type:l.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(i){const t=i.get(l.ICommandService);return i.get(s.SheetsHyperLinkPopupService).currentEditing?t.executeCommand(Q.id):t.executeCommand(q.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"},Pn={outer:g.jsx(ie,{}),link:g.jsx(ie,{}),sheet:g.jsx(we,{}),range:g.jsx(ge,{}),defineName:g.jsx(ge,{}),"range-error":g.jsx(ge,{}),"sheet-error":g.jsx(we,{})},se=()=>{const i=w.useDependency(s.SheetsHyperLinkPopupService),t=w.useDependency(v.HyperLinkModel),n=w.useDependency(l.ICommandService),e=w.useDependency(M.IMessageService),r=w.useDependency(l.LocaleService),o=w.useObservable(i.currentPopup$,i.currentPopup),a=w.useDependency(s.SheetsHyperLinkResolverService);if(!o)return null;const{unitId:c,subUnitId:d,id:u}=o,m=t.getHyperLink(c,d,u);if(!m)return null;const y=a.parseHyperLink(m.payload),h=y.type.indexOf("error")>-1;return g.jsxs("div",{className:A.cellLink,onClick:()=>i.hideCurrentPopup(),children:[g.jsxs("div",{className:Le(A.cellLinkContent,{[A.cellLinkContentError]:h}),onClick:y.handler,children:[g.jsx("div",{className:A.cellLinkType,children:Pn[y.type]}),g.jsx("div",{className:A.cellLinkUrl,children:y.name})]}),g.jsxs("div",{className:A.cellLinkOperations,children:[g.jsx("div",{className:Le(A.cellLinkOperation,{[A.cellLinkOperationError]:h}),onClick:()=>{if(!h){if(y.type!=="outer"){const P=new URL(window.location.href);P.hash=y.url.slice(1),navigator.clipboard.writeText(P.href)}else navigator.clipboard.writeText(y.url);e.show({content:r.t("hyperLink.message.coped"),type:I.MessageType.Info})}},children:g.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.copy"),children:g.jsx(vn,{})})}),g.jsx("div",{className:A.cellLinkOperation,onClick:()=>{n.executeCommand(ae.id,{unitId:c,subUnitId:d,row:m.row,column:m.column})},children:g.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.edit"),children:g.jsx(yn,{})})}),g.jsx("div",{className:A.cellLinkOperation,onClick:()=>{n.executeCommand(v.CancelHyperLinkCommand.id,{unitId:c,subUnitId:d,id:m.id})},children:g.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.cancel"),children:g.jsx(Sn,{})})})]})]})};se.componentKey="univer.sheet.cell-link-popup";var bn=Object.defineProperty,Mn=Object.getOwnPropertyDescriptor,On=(i,t,n,e)=>{for(var r=e>1?void 0:e?Mn(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&bn(t,n,r),r},Ne=(i,t)=>(n,e)=>t(n,e,i);s.SheetsHyperLinkPopupService=class{constructor(t,n){V(this,"_currentPopup",null);V(this,"_currentPopup$",new ue.Subject);V(this,"currentPopup$",this._currentPopup$.asObservable());V(this,"_currentEditing$",new ue.BehaviorSubject(null));V(this,"currentEditing$",this._currentEditing$.asObservable());this._hyperLinkModel=t,this._sheetCanvasPopManagerService=n}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}showPopup(t){this.hideCurrentPopup();const{unitId:n,subUnitId:e,row:r,col:o}=t,a=this._hyperLinkModel.getHyperLinkByLocation(n,e,r,o);if(!a)return;const c=this._sheetCanvasPopManagerService.attachPopupToCell(r,o,{componentKey:se.componentKey,direction:"bottom",closeOnSelfTarget:!0});c&&(this._currentPopup={unitId:n,subUnitId:e,id:a.id,disposable:c},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)}},s.SheetsHyperLinkPopupService=On([Ne(0,S.Inject(v.HyperLinkModel)),Ne(1,S.Inject(_.SheetCanvasPopManagerService))],s.SheetsHyperLinkPopupService);var En=Object.defineProperty,Hn=Object.getOwnPropertyDescriptor,wn=(i,t,n,e)=>{for(var r=e>1?void 0:e?Hn(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&En(t,n,r),r},ee=(i,t)=>(n,e)=>t(n,e,i);s.SheetHyperLinkSetRangeController=class extends l.Disposable{constructor(t,n,e,r,o){super(),this._sheetInterceptorService=t,this._injector=n,this._hyperLinkModel=e,this._selectionManagerService=r,this._univerInstanceService=o,this._initCommandInterceptor()}_initCommandInterceptor(){this._initAddHyperLinkCommandInterceptor(),this._initSetRangeValuesCommandInterceptor(),this._initUpdateHyperLinkCommandInterceptor(),this._initClearSelectionCommandInterceptor()}_initAddHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{if(t.id===v.AddHyperLinkCommand.id){const n=t.params,{unitId:e,subUnitId:r,link:o}=n,a={unitId:e,subUnitId:r,cellValue:{[o.row]:{[o.column]:{v:o.display,t:l.CellValueType.STRING,p:null}}}};return{redos:[{id:p.SetRangeValuesMutation.id,params:a}],undos:[{id:p.SetRangeValuesMutation.id,params:p.SetRangeValuesUndoMutationFactory(this._injector,a)}]}}return{redos:[],undos:[]}}}))}_initUpdateHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{if(t.id===v.UpdateHyperLinkCommand.id){const n=t.params,{unitId:e,subUnitId:r,id:o,payload:a}=n,c=this._hyperLinkModel.getHyperLink(e,r,o);if(c&&c.display!==a.display){const d={unitId:e,subUnitId:r,cellValue:{[c.row]:{[c.column]:{v:a.display,t:l.CellValueType.STRING,p:null}}}};return{redos:[{id:p.SetRangeValuesMutation.id,params:d}],undos:[{id:p.SetRangeValuesMutation.id,params:p.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}}return{redos:[],undos:[]}}}))}_initSetRangeValuesCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{if(t.id===p.SetRangeValuesCommand.id){const n=t.params,{unitId:e,subUnitId:r}=n,o=[],a=[];return n.cellValue&&new l.ObjectMatrix(n.cellValue).forValue((c,d,u)=>{var b,R,E,j;const m=((j=(E=u==null?void 0:u.v)!=null?E:(R=(b=u==null?void 0:u.p)==null?void 0:b.body)==null?void 0:R.dataStream.slice(0,-2))!=null?j:"").toString(),y=this._hyperLinkModel.getHyperLinkByLocation(e,r,c,d);if(!y){if(J(m)){const L=l.Tools.generateRandomId();a.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:e,subUnitId:r,id:L}}),o.push({id:v.AddHyperLinkMutation.id,params:{unitId:e,subUnitId:r,link:{id:L,row:c,column:d,display:m,payload:Te(m)}}})}return}if(y.display===m)return;m||(o.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:e,subUnitId:r,id:y.id}}),a.push({id:v.AddHyperLinkMutation.id,params:{unitId:e,subUnitId:r,link:y}}));const h={unitId:e,subUnitId:r,id:y.id,payload:{payload:y.payload,display:m}},P={unitId:e,subUnitId:r,id:y.id,payload:{payload:y.payload,display:y.display}};o.push({id:v.UpdateHyperLinkMutation.id,params:h}),a.push({id:v.UpdateHyperLinkMutation.id,params:P})}),{undos:a,redos:o}}return{redos:[],undos:[]}}}))}_initClearSelectionCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{if(t.id===p.ClearSelectionContentCommand.id||t.id===p.ClearSelectionAllCommand.id){const n=[],e=[],r=this._selectionManagerService.getFirst(),o=p.getSheetCommandTarget(this._univerInstanceService);if(r&&o){const{unitId:a,subUnitId:c}=o;l.Range.foreach(r.range,(d,u)=>{const m=this._hyperLinkModel.getHyperLinkByLocation(a,c,d,u);m&&(n.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:a,subUnitId:c,id:m.id}}),e.push({id:v.AddHyperLinkMutation.id,params:{unitId:a,subUnitId:c,link:m}}))})}return{redos:n,undos:e}}return{redos:[],undos:[]}}}))}},s.SheetHyperLinkSetRangeController=wn([l.OnLifecycle(l.LifecycleStages.Starting,s.SheetHyperLinkSetRangeController),ee(0,S.Inject(p.SheetInterceptorService)),ee(1,S.Inject(S.Injector)),ee(2,S.Inject(v.HyperLinkModel)),ee(3,S.Inject(p.SelectionManagerService)),ee(4,l.IUniverInstanceService)],s.SheetHyperLinkSetRangeController);var jn=Object.defineProperty,Tn=Object.getOwnPropertyDescriptor,Un=(i,t,n,e)=>{for(var r=e>1?void 0:e?Tn(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&jn(t,n,r),r},De=(i,t)=>(n,e)=>t(n,e,i);s.SheetsHyperLinkPopupController=class extends l.Disposable{constructor(t,n){super(),this._hoverManagerService=t,this._sheetsHyperLinkPopupService=n,this._initHoverListener()}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(ue.debounceTime(100)).subscribe(t=>{if(!t){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}this._sheetsHyperLinkPopupService.showPopup(t.location)}))}},s.SheetsHyperLinkPopupController=Un([l.OnLifecycle(l.LifecycleStages.Rendered,s.SheetsHyperLinkPopupController),De(0,S.Inject(_.HoverManagerService)),De(1,S.Inject(s.SheetsHyperLinkPopupService))],s.SheetsHyperLinkPopupController);const Nn=i=>({id:q.id,type:M.MenuItemType.BUTTON,positions:[M.MenuPosition.CONTEXT_MENU],title:"hyperLink.menu.add",hidden$:M.getMenuHiddenObservable(i,l.UniverInstanceType.UNIVER_SHEET),icon:"LinkSingle",disabled$:_.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookEditablePermission],worksheetTypes:[p.WorksheetEditPermission,p.WorksheetSetCellValuePermission,p.WorksheetInsertHyperlinkPermission],rangeTypes:[p.RangeProtectionPermissionEditPoint]})}),Dn=i=>({tooltip:"hyperLink.form.addTitle",positions:M.MenuPosition.TOOLBAR_START,group:M.MenuGroup.TOOLBAR_OTHERS,id:Ue.id,type:M.MenuItemType.BUTTON,icon:"LinkSingle",hidden$:M.getMenuHiddenObservable(i,l.UniverInstanceType.UNIVER_SHEET),disabled$:_.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookEditablePermission],worksheetTypes:[p.WorksheetEditPermission,p.WorksheetSetCellValuePermission,p.WorksheetInsertHyperlinkPermission],rangeTypes:[p.RangeProtectionPermissionEditPoint]})}),me={id:q.id,binding:M.KeyCode.K|M.MetaKeys.CTRL_COMMAND,preconditions:_.whenSheetEditorFocused};var An=Object.defineProperty,Vn=Object.getOwnPropertyDescriptor,Wn=(i,t,n,e)=>{for(var r=e>1?void 0:e?Vn(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&An(t,n,r),r},Y=(i,t)=>(n,e)=>t(n,e,i);s.SheetsHyperLinkUIController=class extends l.Disposable{constructor(t,n,e,r,o,a,c){super(),this._config=t,this._componentManager=n,this._commandService=e,this._localeService=r,this._menuService=o,this._injector=a,this._shortcutService=c,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[se,se.componentKey],[oe,oe.componentKey],[ie,"LinkSingle"]].forEach(([t,n])=>{this._componentManager.register(n,t)})}_initCommands(){[ae,Q,q,Ue].forEach(t=>{this._commandService.registerCommand(t)})}_initMenus(){var t,n,e,r;this._menuService.addMenuItem(Nn(this._injector),(n=(t=this._config)==null?void 0:t.menu)!=null?n:{}),this._menuService.addMenuItem(Dn(this._injector),(r=(e=this._config)==null?void 0:e.menu)!=null?r:{})}_initShortCut(){this._shortcutService.registerShortcut(me)}},s.SheetsHyperLinkUIController=Wn([l.OnLifecycle(l.LifecycleStages.Ready,s.SheetsHyperLinkUIController),Y(1,S.Inject(M.ComponentManager)),Y(2,l.ICommandService),Y(3,S.Inject(l.LocaleService)),Y(4,M.IMenuService),Y(5,S.Inject(S.Injector)),Y(6,S.Inject(M.IShortcutService))],s.SheetsHyperLinkUIController);var $n=Object.defineProperty,xn=Object.getOwnPropertyDescriptor,Bn=(i,t,n,e)=>{for(var r=e>1?void 0:e?xn(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&$n(t,n,r),r},Ae=(i,t)=>(n,e)=>t(n,e,i);s.SheetsHyperLinkAutoFillController=class extends l.Disposable{constructor(t,n){super(),this._autoFillService=t,this._hyperLinkModel=n,this._initAutoFill()}_initAutoFill(){const t=()=>({redos:[],undos:[]}),n=(r,o)=>{const{source:a,target:c,unitId:d,subUnitId:u}=r,m=_.virtualizeDiscreteRanges([a,c]),[y,h]=m.ranges,{mapFunc:P}=m,b={row:y.startRow,col:y.startColumn},R=_.getAutoFillRepeatRange(y,h),E=[],j=[];return R.forEach(L=>{const D=L.repeatStartCell,Z=L.relativeRange,T={startRow:b.row,startColumn:b.col,endColumn:b.col,endRow:b.row},K={startRow:D.row,startColumn:D.col,endColumn:D.col,endRow:D.row};l.Range.foreach(Z,(B,F)=>{const ne=l.Rectangle.getPositionRange({startRow:B,startColumn:F,endColumn:F,endRow:B},T),{row:fe,col:de}=P(ne.startRow,ne.startColumn),f=this._hyperLinkModel.getHyperLinkByLocation(d,u,fe,de);if(f){const k=l.Rectangle.getPositionRange({startRow:B,startColumn:F,endColumn:F,endRow:B},K),{row:O,col:U}=P(k.startRow,k.startColumn),G=l.Tools.generateRandomId(),W=this._hyperLinkModel.getHyperLinkByLocation(d,u,O,U);W&&E.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:u,id:W.id}}),_.APPLY_TYPE.COPY===o&&(E.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:u,link:{...f,id:G,row:O,column:U}}}),j.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:u,id:G}})),W&&j.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:u,link:W}})}})}),{undos:j,redos:E}},e={id:he,onFillData:(r,o,a)=>a===_.APPLY_TYPE.COPY||a===_.APPLY_TYPE.ONLY_FORMAT||a===_.APPLY_TYPE.SERIES?n(r,a):t()};this.disposeWithMe(this._autoFillService.addHook(e))}},s.SheetsHyperLinkAutoFillController=Bn([l.OnLifecycle(l.LifecycleStages.Ready,s.SheetsHyperLinkAutoFillController),Ae(0,_.IAutoFillService),Ae(1,S.Inject(v.HyperLinkModel))],s.SheetsHyperLinkAutoFillController);var Fn=Object.defineProperty,zn=Object.getOwnPropertyDescriptor,Yn=(i,t,n,e)=>{for(var r=e>1?void 0:e?zn(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Fn(t,n,r),r},le=(i,t)=>(n,e)=>t(n,e,i);s.SheetsHyperLinkCopyPasteController=class extends l.Disposable{constructor(n,e,r,o){super();V(this,"_copyInfo");this._sheetClipboardService=n,this._hyperLinkModel=e,this._injector=r,this._resolverService=o,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:he,onBeforeCopy:(n,e,r)=>this._collect(n,e,r),onPasteCells:(n,e,r,o)=>{const{copyType:a=_.COPY_TYPE.COPY,pasteType:c}=o,{range:d}=n||{},{range:u,unitId:m,subUnitId:y}=e;return this._generateMutations(u,{copyType:a,pasteType:c,copyRange:d,unitId:m,subUnitId:y})},onPastePlainText:(n,e)=>{if(J(e)){let r=Te(e);const o=new URL(r),a=e;o.hostname===location.hostname&&o.port===location.port&&o.protocol===location.protocol&&o.pathname===location.pathname&&o.hash&&(r=o.hash);const{range:c,unitId:d,subUnitId:u}=n,{ranges:[m],mapFunc:y}=_.virtualizeDiscreteRanges([c]),h=[],P=[];return l.Range.foreach(m,(b,R)=>{const{row:E,col:j}=y(b,R),L=this._hyperLinkModel.getHyperLinkByLocation(d,u,E,j);L&&h.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:u,id:L.id}});const D=l.Tools.generateRandomId();h.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:u,link:{id:D,row:E,column:j,display:a,payload:r}}}),P.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:u,id:D}}),L&&P.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:u,link:L}})}),{redos:h,undos:P}}return{undos:[],redos:[]}}})}_collect(n,e,r){const o=new l.ObjectMatrix;this._copyInfo={unitId:n,subUnitId:e,matrix:o};const a={get:this._injector.get.bind(this._injector)},c=_.rangeToDiscreteRange(r,a,n,e);if(!c)return;const{rows:d,cols:u}=c;d.forEach((m,y)=>{u.forEach((h,P)=>{var R;const b=this._hyperLinkModel.getHyperLinkByLocation(n,e,m,h);o.setValue(y,P,(R=b==null?void 0:b.id)!=null?R:"")})})}_generateMutations(n,e){if(!this._copyInfo)return{redos:[],undos:[]};if(e.copyType===_.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!e.copyRange)return{redos:[],undos:[]};if([_.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,_.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,_.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,xe.SPECIAL_PASTE_FORMULA].includes(e.pasteType))return{redos:[],undos:[]};const{unitId:r,subUnitId:o}=this._copyInfo,a=[],c=[],{ranges:[d,u],mapFunc:m}=_.virtualizeDiscreteRanges([e.copyRange,n]);return _.getRepeatRange(d,u,!0).forEach(({startRange:h})=>{var P;(P=this._copyInfo)==null||P.matrix.forValue((b,R,E)=>{const j=l.Rectangle.getPositionRange({startRow:b,endRow:b,startColumn:R,endColumn:R},h),L=this._hyperLinkModel.getHyperLink(r,o,E),{row:D,col:Z}=m(j.startRow,j.startColumn),T=this._hyperLinkModel.getHyperLinkByLocation(e.unitId,e.subUnitId,D,Z),K=l.Tools.generateRandomId();T&&a.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:e.unitId,subUnitId:e.subUnitId,id:T.id}}),L&&(a.push({id:v.AddHyperLinkMutation.id,params:{unitId:e.unitId,subUnitId:e.subUnitId,link:{...L,id:K,row:D,column:Z}}}),c.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:e.unitId,subUnitId:e.subUnitId,id:K}})),T&&c.push({id:v.AddHyperLinkMutation.id,params:{unitId:e.unitId,subUnitId:e.subUnitId,link:T}})})}),{redos:a,undos:c}}},s.SheetsHyperLinkCopyPasteController=Yn([l.OnLifecycle(l.LifecycleStages.Ready,s.SheetsHyperLinkCopyPasteController),le(0,_.ISheetClipboardService),le(1,S.Inject(v.HyperLinkModel)),le(2,S.Inject(S.Injector)),le(3,S.Inject(s.SheetsHyperLinkResolverService))],s.SheetsHyperLinkCopyPasteController);var Zn=Object.defineProperty,Kn=Object.getOwnPropertyDescriptor,Gn=(i,t,n,e)=>{for(var r=e>1?void 0:e?Kn(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Zn(t,n,r),r},Xn=(i,t)=>(n,e)=>t(n,e,i);s.SheetHyperLinkUrlController=class extends l.Disposable{constructor(t){super(),this._resolverService=t,this._handleInitUrl()}_handleInitUrl(){const t=location.hash;t&&this._resolverService.parseHyperLink(t).handler()}},s.SheetHyperLinkUrlController=Gn([l.OnLifecycle(l.LifecycleStages.Rendered,s.SheetHyperLinkUrlController),Xn(0,S.Inject(s.SheetsHyperLinkResolverService))],s.SheetHyperLinkUrlController);var Jn=Object.defineProperty,Qn=Object.getOwnPropertyDescriptor,qn=(i,t,n,e)=>{for(var r=e>1?void 0:e?Qn(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Jn(t,n,r),r},Se=(i,t)=>(n,e)=>t(n,e,i);let ce=class extends l.Disposable{constructor(i,t,n){super(),this._localeService=i,this._commandService=t,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(i=>{i.id===me.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookEditablePermission],rangeTypes:[p.RangeProtectionPermissionEditPoint],worksheetTypes:[p.WorksheetEditPermission,p.WorksheetSetCellValuePermission,p.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")))}))}};ce=qn([l.OnLifecycle(l.LifecycleStages.Rendered,ce),Se(0,S.Inject(l.LocaleService)),Se(1,l.ICommandService),Se(2,S.Inject(_.SheetPermissionInterceptorBaseController))],ce);var Ve=Object.defineProperty,et=Object.getOwnPropertyDescriptor,nt=(i,t,n)=>t in i?Ve(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,tt=(i,t,n,e)=>{for(var r=e>1?void 0:e?et(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ve(t,n,r),r},We=(i,t)=>(n,e)=>t(n,e,i),$e=(i,t,n)=>(nt(i,typeof t!="symbol"?t+"":t,n),n);s.UniverSheetsHyperLinkUIPlugin=class extends l.Plugin{constructor(t,n,e){super(),this._config=t,this._injector=n,this._renderManagerService=e}onStarting(t){[[s.SheetsHyperLinkResolverService],[s.SheetsHyperLinkPopupService],[s.SheetsHyperLinkRemoveSheetController],[s.SheetsHyperLinkRefRangeController],[s.SheetsHyperLinkRenderManagerController],[s.SheetHyperLinkSetRangeController],[s.SheetsHyperLinkPopupController],[s.SheetsHyperLinkUIController,{useFactory:()=>this._injector.createInstance(s.SheetsHyperLinkUIController,this._config)}],[s.SheetsHyperLinkAutoFillController],[s.SheetsHyperLinkCopyPasteController],[ce],[s.SheetHyperLinkUrlController]].forEach(e=>t.add(e)),this._renderManagerService.registerRenderController(l.UniverInstanceType.UNIVER_SHEET,s.SheetsHyperLinkRenderController)}},$e(s.UniverSheetsHyperLinkUIPlugin,"pluginName",he),$e(s.UniverSheetsHyperLinkUIPlugin,"type",l.UniverInstanceType.UNIVER_SHEET),s.UniverSheetsHyperLinkUIPlugin=tt([l.DependentOn(v.UniverSheetsHyperLinkPlugin),We(1,S.Inject(S.Injector)),We(2,Ce.IRenderManagerService)],s.UniverSheetsHyperLinkUIPlugin),s.CloseHyperLinkSidebarOperation=Q,s.InsertHyperLinkOperation=q,s.InsertLinkShortcut=me,s.OpenHyperLinkSidebarOperation=ae,Object.defineProperty(s,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.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"require": "./lib/cjs/*",
|
|
35
35
|
"types": "./lib/types/index.d.ts"
|
|
36
36
|
},
|
|
37
|
-
"./
|
|
38
|
-
"./
|
|
37
|
+
"./lib/*": "./lib/*",
|
|
38
|
+
"./locale/*": "./lib/locale/*.json"
|
|
39
39
|
},
|
|
40
40
|
"main": "./lib/cjs/index.js",
|
|
41
41
|
"module": "./lib/es/index.js",
|
|
@@ -54,19 +54,19 @@
|
|
|
54
54
|
"clsx": ">=2.0.0",
|
|
55
55
|
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
|
|
56
56
|
"rxjs": ">=7.0.0",
|
|
57
|
-
"@univerjs/
|
|
58
|
-
"@univerjs/
|
|
59
|
-
"@univerjs/
|
|
60
|
-
"@univerjs/engine-render": "0.1.
|
|
61
|
-
"@univerjs/sheets-formula": "0.1.
|
|
62
|
-
"@univerjs/sheets": "0.1.
|
|
63
|
-
"@univerjs/sheets-hyper-link": "0.1.
|
|
64
|
-
"@univerjs/sheets-ui": "0.1.
|
|
65
|
-
"@univerjs/ui": "0.1.
|
|
57
|
+
"@univerjs/core": "0.1.14",
|
|
58
|
+
"@univerjs/design": "0.1.14",
|
|
59
|
+
"@univerjs/engine-formula": "0.1.14",
|
|
60
|
+
"@univerjs/engine-render": "0.1.14",
|
|
61
|
+
"@univerjs/sheets-formula": "0.1.14",
|
|
62
|
+
"@univerjs/sheets": "0.1.14",
|
|
63
|
+
"@univerjs/sheets-hyper-link": "0.1.14",
|
|
64
|
+
"@univerjs/sheets-ui": "0.1.14",
|
|
65
|
+
"@univerjs/ui": "0.1.14"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@univerjs/icons": "^0.1.
|
|
69
|
-
"@univerjs/sheets-hyper-link": "0.1.
|
|
68
|
+
"@univerjs/icons": "^0.1.56",
|
|
69
|
+
"@univerjs/sheets-hyper-link": "0.1.14"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@wendellhu/redi": "^0.15.2",
|
|
@@ -75,14 +75,28 @@
|
|
|
75
75
|
"typescript": "^5.4.5",
|
|
76
76
|
"vite": "^5.2.12",
|
|
77
77
|
"vitest": "^1.6.0",
|
|
78
|
-
"@univerjs/engine-formula": "0.1.
|
|
79
|
-
"@univerjs/
|
|
80
|
-
"@univerjs/
|
|
81
|
-
"@univerjs/
|
|
82
|
-
"@univerjs/
|
|
83
|
-
"@univerjs/
|
|
84
|
-
"@univerjs/
|
|
85
|
-
"@univerjs/ui": "0.1.
|
|
78
|
+
"@univerjs/engine-formula": "0.1.14",
|
|
79
|
+
"@univerjs/core": "0.1.14",
|
|
80
|
+
"@univerjs/sheets": "0.1.14",
|
|
81
|
+
"@univerjs/engine-render": "0.1.14",
|
|
82
|
+
"@univerjs/sheets-formula": "0.1.14",
|
|
83
|
+
"@univerjs/ui": "0.1.14",
|
|
84
|
+
"@univerjs/shared": "0.1.14",
|
|
85
|
+
"@univerjs/sheets-ui": "0.1.14"
|
|
86
|
+
},
|
|
87
|
+
"univerSpace": {
|
|
88
|
+
".": {
|
|
89
|
+
"import": "./lib/es/index.js",
|
|
90
|
+
"require": "./lib/cjs/index.js",
|
|
91
|
+
"types": "./lib/types/index.d.ts"
|
|
92
|
+
},
|
|
93
|
+
"./*": {
|
|
94
|
+
"import": "./lib/es/*",
|
|
95
|
+
"require": "./lib/cjs/*",
|
|
96
|
+
"types": "./lib/types/index.d.ts"
|
|
97
|
+
},
|
|
98
|
+
"./lib/*": "./lib/*",
|
|
99
|
+
"./locale/*": "./lib/locale/*.json"
|
|
86
100
|
},
|
|
87
101
|
"scripts": {
|
|
88
102
|
"test": "vitest run",
|