@univerjs/sheets-crosshair-highlight 0.5.5-experimental.20250122-3362a4a → 0.5.5-nightly.202501201336
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/facade.js +1 -1
- package/lib/cjs/index.js +9 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +24 -31
- package/lib/es/index.js +325 -310
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +2 -2
- package/lib/es/locale/vi-VN.js +2 -2
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +2 -2
- package/lib/types/facade/f-univer.d.ts +0 -3
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +9 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +7 -7
package/lib/cjs/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const h=require("@univerjs/core"),i=require("@univerjs/sheets-crosshair-highlight");class o extends h.FUniver{_initialize(e){const s=e.get(h.ICommandService);this.disposeWithMe(s.onCommandExecuted(r=>{if(r.id===i.EnableCrosshairHighlightOperation.id||r.id===i.DisableCrosshairHighlightOperation.id){const t=this.getActiveSheet();if(!t||!this._eventListend(this.Event.CrosshairHighlightEnabledChanged))return;this.fireEvent(this.Event.CrosshairHighlightEnabledChanged,{enabled:this.getCrosshairHighlightEnabled(),...t})}if(r.id===i.SetCrosshairHighlightColorOperation.id){const t=this.getActiveSheet();if(!t||!this._eventListend(this.Event.CrosshairHighlightColorChanged))return;this.fireEvent(this.Event.CrosshairHighlightColorChanged,{color:this.getCrosshairHighlightColor(),...t})}}))}setCrosshairHighlightEnabled(e){return e?this._commandService.syncExecuteCommand(i.EnableCrosshairHighlightOperation.id):this._commandService.syncExecuteCommand(i.DisableCrosshairHighlightOperation.id),this}setCrosshairHighlightColor(e){return this._commandService.syncExecuteCommand(i.SetCrosshairHighlightColorOperation.id,{value:e}),this}getCrosshairHighlightEnabled(){return this._injector.get(i.SheetsCrosshairHighlightService).enabled}getCrosshairHighlightColor(){return this._injector.get(i.SheetsCrosshairHighlightService).color}get CROSSHAIR_HIGHLIGHT_COLORS(){return i.CROSSHAIR_HIGHLIGHT_COLORS}}h.FUniver.extend(o);
|
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),engineRender=require("@univerjs/engine-render"),ui=require("@univerjs/ui"),rxjs=require("rxjs"),jsxRuntime=require("react/jsx-runtime"),react=require("react"),sheets=require("@univerjs/sheets"),sheetsUi=require("@univerjs/sheets-ui"),SHEETS_CROSSHAIR_HIGHLIGHT_PLUGIN_CONFIG_KEY="sheets-crosshair-highlight.config",defaultPluginConfig={};var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=react.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=react.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return react.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a4){var key=_a4[0],value=_a4[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a4,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a4=node.children)===null||_a4===void 0)&&_a4.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid");IconBase.displayName="UniverIcon";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#E5E5E5",d:"M1.6499 3.65002C1.6499 2.54545 2.54533 1.65002 3.6499 1.65002H12.3499C13.4545 1.65002 14.3499 2.54545 14.3499 3.65002V12.35C14.3499 13.4546 13.4545 14.35 12.3499 14.35H3.6499C2.54533 14.35 1.6499 13.4546 1.6499 12.35V3.65002Z"}},{tag:"path",attrs:{fill:"#fff",d:"M9.9998 1.65002H5.9998V6H1.6499V10H5.9998V14.35H9.9998V10H14.3499V6H9.9998V1.65002Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M3.6498 1.05005C2.21386 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V3.65005C14.9498 2.21411 13.7857 1.05005 12.3498 1.05005H3.6498ZM5.4002 2.25005H3.6498C2.87661 2.25005 2.2498 2.87685 2.2498 3.65005V5.40002H5.4002V2.25005ZM2.2498 10.6V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H5.4002V10.6H2.2498ZM6.60019 13.75H9.4002V9.40002H13.7498V6.60002H9.4002V2.25005H6.60019V6.60002H2.25029V9.40002H6.60019V13.75ZM10.6002 2.25005V5.40002H13.7498V3.65005C13.7498 2.87685 13.123 2.25005 12.3498 2.25005H10.6002ZM13.7498 10.6H10.6002V13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.6Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CrossHighlightingSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"cross-highlighting-single",ref,icon:element}))});CrossHighlightingSingle.displayName="CrossHighlightingSingle";const CROSSHAIR_HIGHLIGHT_COLORS=["rgba(158, 109, 227, 0.3)","rgba(254, 75, 75, 0.3)","rgba(255, 140, 81, 0.3)","rgba(164, 220, 22, 0.3)","rgba(45, 174, 255, 0.3)","rgba(58, 96, 247, 0.3)","rgba(242, 72, 166, 0.3)","rgba(153, 153, 153, 0.3)","rgba(158, 109, 227, 0.15)","rgba(254, 75, 75, 0.15)","rgba(255, 140, 81, 0.15)","rgba(164, 220, 22, 0.15)","rgba(45, 174, 255, 0.15)","rgba(58, 96, 247, 0.15)","rgba(242, 72, 166, 0.15)","rgba(153, 153, 153, 0.15)"],_SheetsCrosshairHighlightService=class _SheetsCrosshairHighlightService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_enabled$",new rxjs.BehaviorSubject(!1));__publicField(this,"enabled$",this._enabled$.asObservable());__publicField(this,"_color$",new rxjs.BehaviorSubject(CROSSHAIR_HIGHLIGHT_COLORS[0]));__publicField(this,"color$",this._color$.asObservable())}get enabled(){return this._enabled$.getValue()}get color(){return this._color$.getValue()}dispose(){this._enabled$.complete()}setEnabled(value){this._enabled$.next(value)}setColor(value){this._color$.next(value)}};__name(_SheetsCrosshairHighlightService,"SheetsCrosshairHighlightService");let SheetsCrosshairHighlightService=_SheetsCrosshairHighlightService;const ToggleCrosshairHighlightOperation={id:"sheet.operation.toggle-crosshair-highlight",type:core.CommandType.OPERATION,handler(accessor){const service=accessor.get(SheetsCrosshairHighlightService),turnedOn=service.enabled;return service.setEnabled(!turnedOn),!0}},SetCrosshairHighlightColorOperation={id:"sheet.operation.set-crosshair-highlight-color",type:core.CommandType.OPERATION,handler(accessor,{value}){const service=accessor.get(SheetsCrosshairHighlightService);return service.enabled||service.setEnabled(!0),service.setColor(value),!0}},EnableCrosshairHighlightOperation={id:"sheet.operation.enable-crosshair-highlight",type:core.CommandType.OPERATION,handler(accessor){const service=accessor.get(SheetsCrosshairHighlightService);return service.enabled?!1:(service.setEnabled(!0),!0)}},DisableCrosshairHighlightOperation={id:"sheet.operation.disable-crosshair-highlight",type:core.CommandType.OPERATION,handler(accessor){const service=accessor.get(SheetsCrosshairHighlightService);return service.enabled?(service.setEnabled(!1),!0):!1}};function r(e){var t,f,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}__name(r,"r");function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}__name(clsx,"clsx");const crosshairHighlightOverlay="univer-crosshair-highlight-overlay",crosshairHighlightItem="univer-crosshair-highlight-item",crosshairHighlightItemSelected="univer-crosshair-highlight-item-selected",styles={crosshairHighlightOverlay,crosshairHighlightItem,crosshairHighlightItemSelected};function CrosshairOverlay(props){const{onChange}=props,crosshairSrv=core.useDependency(SheetsCrosshairHighlightService),currentColor=core.useObservable(crosshairSrv.color$),handleColorPicked=react.useCallback(color=>{onChange==null||onChange(color)},[onChange]);return jsxRuntime.jsx("div",{className:styles.crosshairHighlightOverlay,children:CROSSHAIR_HIGHLIGHT_COLORS.map(color=>jsxRuntime.jsx("div",{className:clsx(styles.crosshairHighlightItem,{[styles.crosshairHighlightItemSelected]:color===currentColor}),style:{backgroundColor:color},onClick:__name(()=>handleColorPicked(color),"onClick")},color))})}__name(CrosshairOverlay,"CrosshairOverlay");const CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT="CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";function CrosshairHighlightMenuItemFactory(accessor){const crosshairHighlightService=accessor.get(SheetsCrosshairHighlightService);return{id:ToggleCrosshairHighlightOperation.id,tooltip:"crosshair.button.tooltip",type:ui.MenuItemType.BUTTON_SELECTOR,icon:"CrossHighlightingSingle",selections:[{label:{name:CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT,hoverable:!1}}],selectionsCommandId:SetCrosshairHighlightColorOperation.id,activated$:crosshairHighlightService.enabled$,hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET)}}__name(CrosshairHighlightMenuItemFactory,"CrosshairHighlightMenuItemFactory");const menuSchema={[ui.ContextMenuPosition.FOOTER_MENU]:{[ui.ContextMenuGroup.OTHERS]:{[ToggleCrosshairHighlightOperation.id]:{order:0,menuItemFactory:CrosshairHighlightMenuItemFactory}}}};var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2"),_a;let SheetsCrosshairHighlightController=(_a=class extends core.Disposable{constructor(_componentMgr,_menuManagerService,_cmdSrv){super(),this._componentMgr=_componentMgr,this._menuManagerService=_menuManagerService,this._cmdSrv=_cmdSrv,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[ToggleCrosshairHighlightOperation,SetCrosshairHighlightColorOperation,EnableCrosshairHighlightOperation,DisableCrosshairHighlightOperation].forEach(c=>this._cmdSrv.registerCommand(c))}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_initComponents(){this._componentMgr.register(CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT,CrosshairOverlay),this._componentMgr.register("CrossHighlightingSingle",CrossHighlightingSingle)}},__name(_a,"SheetsCrosshairHighlightController"),_a);SheetsCrosshairHighlightController=__decorateClass$2([__decorateParam$2(0,core.Inject(ui.ComponentManager)),__decorateParam$2(1,ui.IMenuManagerService),__decorateParam$2(2,core.ICommandService)],SheetsCrosshairHighlightController);const SHEETS_CROSSHAIR_HIGHLIGHT_Z_INDEX=1,_CrossHairRangeCollection=class _CrossHairRangeCollection{constructor(){__publicField(this,"_selectedRanges",[]);__publicField(this,"_ranges",[])}addRange(range){if(range.rangeType===core.RANGE_TYPE.COLUMN||range.rangeType===core.RANGE_TYPE.ROW||range.rangeType===core.RANGE_TYPE.ALL)return;const intersects=this._getIntersects(range),splitRanges=this._getSplitRanges(range,intersects);splitRanges.length>0&&this._ranges.push(...splitRanges)}setSelectedRanges(selectedRange){this._selectedRanges=selectedRange}_getSplitRanges(range,intersects){let splitRanges=[range];for(const intersect of intersects.concat(this._selectedRanges)){const newRanges=[];for(const splitRange of splitRanges){const split=core.Rectangle.subtract(splitRange,intersect);split&&split.length>0&&newRanges.push(...split)}splitRanges=newRanges}return splitRanges.filter(range2=>range2.startRow<=range2.endRow&&range2.startColumn<=range2.endColumn)}_getIntersects(addRange){const intersects=[];for(const range of this._ranges){const intersect=core.Rectangle.getIntersects(range,addRange);intersect&&intersects.push(intersect)}return intersects}getRanges(){return this._ranges}reset(){this._ranges=[],this._selectedRanges=[]}};__name(_CrossHairRangeCollection,"CrossHairRangeCollection");let CrossHairRangeCollection=_CrossHairRangeCollection;const _SheetCrossHairHighlightShape=class _SheetCrossHairHighlightShape extends engineRender.Shape{constructor(key,props){super(key,props);__publicField(this,"_color");props&&this.setShapeProps(props)}setShapeProps(props){typeof props.color<"u"&&(this._color=props.color),this.transformByState({width:props.width,height:props.height})}_draw(ctx){const color=`rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${this._color.a})`;engineRender.Rect.drawWith(ctx,{width:this.width,height:this.height,fill:color,stroke:void 0,strokeWidth:0,evented:!1})}};__name(_SheetCrossHairHighlightShape,"SheetCrossHairHighlightShape");let SheetCrossHairHighlightShape=_SheetCrossHairHighlightShape;var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1"),_a2;let SheetCrosshairHighlightRenderController=(_a2=class extends core.Disposable{constructor(_context,_sheetSkeletonManagerService,_sheetsSelectionsService,_sheetsCrosshairHighlightService,_contextService,_refSelectionsService){super();__publicField(this,"_shapes",[]);__publicField(this,"_rangeCollection",new CrossHairRangeCollection);__publicField(this,"_color","rgba(255,0,0,0.5)");this._context=_context,this._sheetSkeletonManagerService=_sheetSkeletonManagerService,this._sheetsSelectionsService=_sheetsSelectionsService,this._sheetsCrosshairHighlightService=_sheetsCrosshairHighlightService,this._contextService=_contextService,this._refSelectionsService=_refSelectionsService,this._initRenderListener()}_transformSelection(selectionData,sheet){if(!selectionData)return;const rowCount=sheet.getRowCount(),columnCount=sheet.getColumnCount(),ranges=[];for(const selection of selectionData){const{startRow,endRow,startColumn,endColumn}=selection.range;endRow-startRow+1===rowCount||endColumn-startColumn+1===columnCount||ranges.push(selection.range)}this._rangeCollection.setSelectedRanges(ranges);for(const range of ranges)this.addSelection(range,sheet)}_initRenderListener(){const workbook=this._context.unit;this.disposeWithMe(rxjs.combineLatest([this._contextService.subscribeContextValue$(sheets.REF_SELECTIONS_ENABLED).pipe(rxjs.startWith(!1)),this._sheetSkeletonManagerService.currentSkeleton$,this._sheetsCrosshairHighlightService.enabled$,this._sheetsCrosshairHighlightService.color$.pipe(rxjs.tap(color=>this._color=color)),rxjs.merge(this._sheetsSelectionsService.selectionMoveStart$,this._sheetsSelectionsService.selectionMoving$,this._sheetsSelectionsService.selectionMoveEnd$,this._sheetsSelectionsService.selectionSet$,workbook.activeSheet$.pipe(rxjs.map(()=>this._sheetsSelectionsService.getCurrentSelections()))),rxjs.merge(this._refSelectionsService.selectionMoveStart$,this._refSelectionsService.selectionMoving$,this._refSelectionsService.selectionMoveEnd$,this._sheetsSelectionsService.selectionSet$,workbook.activeSheet$.pipe(rxjs.map(()=>this._refSelectionsService.getCurrentSelections())))]).subscribe(([refSelectionEnabled,_,enabled,_color,normalSelections,refSelection])=>{if(this._clear(),!enabled)return;const selections=refSelectionEnabled?refSelection:normalSelections;this._rangeCollection.reset(),this._transformSelection(selections,workbook.getActiveSheet()),this.render(this._rangeCollection.getRanges())}))}addSelection(range,sheet){if(range.rangeType===core.RANGE_TYPE.COLUMN||range.rangeType===core.RANGE_TYPE.ROW||range.rangeType===core.RANGE_TYPE.ALL)return;const maxRow=sheet.getRowCount(),maxColumn=sheet.getColumnCount(),{startRow,endRow,startColumn,endColumn}=range,left={startRow,endRow,startColumn:0,endColumn:startColumn-1},right={startRow,endRow,startColumn:endColumn+1,endColumn:maxColumn},top={startRow:0,endRow:startRow-1,startColumn,endColumn},bottom={startRow:endRow+1,endRow:maxRow,startColumn,endColumn};for(const range2 of[left,right,top,bottom])range2.startRow<=range2.endRow&&range2.startColumn<=range2.endColumn&&this._rangeCollection.addRange(range2)}_clear(){this._shapes.forEach(shape=>{shape.dispose()}),this._shapes=[]}_addShapes(range,index,scene,skeleton){const{startRow,endRow,startColumn,endColumn}=range,startPosition=sheetsUi.getCoordByCell(startRow,startColumn,scene,skeleton),endPosition=sheetsUi.getCoordByCell(endRow,endColumn,scene,skeleton),{startX,startY}=startPosition,{endX,endY}=endPosition,width=endX-startX,height=endY-startY,shapeProps={left:startX,top:startY,color:new core.ColorKit(this._color).toRgb(),width,height,zIndex:SHEETS_CROSSHAIR_HIGHLIGHT_Z_INDEX,evented:!1},currentShapes=new SheetCrossHairHighlightShape(`crosshair-${index}`,shapeProps);this._shapes.push(currentShapes),scene.addObject(currentShapes)}render(ranges){const skeleton=this._sheetSkeletonManagerService.getCurrentSkeleton();if(!skeleton)return;const{scene}=this._context;this._clear();for(let i=0;i<ranges.length;i++){const range=ranges[i];this._addShapes(range,i,scene,skeleton)}scene.makeDirty(!0)}async dispose(){super.dispose()}},__name(_a2,"SheetCrosshairHighlightRenderController"),_a2);SheetCrosshairHighlightRenderController=__decorateClass$1([__decorateParam$1(1,core.Inject(sheetsUi.SheetSkeletonManagerService)),__decorateParam$1(2,core.Inject(sheets.SheetsSelectionsService)),__decorateParam$1(3,core.Inject(SheetsCrosshairHighlightService)),__decorateParam$1(4,core.Inject(core.IContextService)),__decorateParam$1(5,sheets.IRefSelectionsService)],SheetCrosshairHighlightRenderController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),_a3;exports.UniverSheetsCrosshairHighlightPlugin=(_a3=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_renderManagerService,_configService){super(),this._config=_config,this._injector=_injector,this._renderManagerService=_renderManagerService,this._configService=_configService;const{...rest}=core.merge({},defaultPluginConfig,this._config);this._configService.setConfig(SHEETS_CROSSHAIR_HIGHLIGHT_PLUGIN_CONFIG_KEY,rest)}onStarting(){[[SheetsCrosshairHighlightService],[SheetsCrosshairHighlightController]].forEach(d=>this._injector.add(d))}onReady(){[[SheetCrosshairHighlightRenderController]].forEach(d=>this._injector.add(d)),this._injector.get(SheetsCrosshairHighlightController),this._renderManagerService.registerRenderModule(core.UniverInstanceType.UNIVER_SHEET,[SheetCrosshairHighlightRenderController])}},__name(_a3,"UniverSheetsCrosshairHighlightPlugin"),__publicField(_a3,"pluginName","SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"),__publicField(_a3,"type",core.UniverInstanceType.UNIVER_SHEET),_a3);exports.UniverSheetsCrosshairHighlightPlugin=__decorateClass([__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,engineRender.IRenderManagerService),__decorateParam(3,core.IConfigService)],exports.UniverSheetsCrosshairHighlightPlugin);exports.CROSSHAIR_HIGHLIGHT_COLORS=CROSSHAIR_HIGHLIGHT_COLORS;exports.DisableCrosshairHighlightOperation=DisableCrosshairHighlightOperation;exports.EnableCrosshairHighlightOperation=EnableCrosshairHighlightOperation;exports.SetCrosshairHighlightColorOperation=SetCrosshairHighlightColorOperation;exports.SheetsCrosshairHighlightService=SheetsCrosshairHighlightService;exports.ToggleCrosshairHighlightOperation=ToggleCrosshairHighlightOperation;
|
|
1
|
+
"use strict";var z=Object.defineProperty;var Q=(n,e,t)=>e in n?z(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var g=(n,e,t)=>Q(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),P=require("@univerjs/engine-render"),m=require("@univerjs/ui"),_=require("rxjs"),C=require("react"),$=require("@univerjs/sheets"),M=require("@univerjs/sheets-ui"),ee="sheets-crosshair-highlight.config",A={};var u=function(){return u=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},u.apply(this,arguments)},te=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},D=C.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,s=n.extend,o=te(n,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),l=C.useRef("_".concat(ie()));return q(t,"".concat(r),{defIds:t.defIds,idSuffix:l.current},u({ref:e,className:c},o),s)});function q(n,e,t,r,i){return C.createElement(n.tag,u(u({key:e},re(n,t,i)),r),(ne(n,t).children||[]).map(function(s,o){return q(s,"".concat(e,"-").concat(n.tag,"-").concat(o),t,void 0,i)}))}function re(n,e,t){var r=u({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(s){var o=s[0],c=s[1];typeof c=="string"&&(r[o]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function ne(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?u(u({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?u(u({},i),{attrs:u(u({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function ie(){return Math.random().toString(36).substring(2,8)}D.displayName="UniverIcon";var se={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#E5E5E5",d:"M1.6499 3.65002C1.6499 2.54545 2.54533 1.65002 3.6499 1.65002H12.3499C13.4545 1.65002 14.3499 2.54545 14.3499 3.65002V12.35C14.3499 13.4546 13.4545 14.35 12.3499 14.35H3.6499C2.54533 14.35 1.6499 13.4546 1.6499 12.35V3.65002Z"}},{tag:"path",attrs:{fill:"#fff",d:"M9.9998 1.65002H5.9998V6H1.6499V10H5.9998V14.35H9.9998V10H14.3499V6H9.9998V1.65002Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M3.6498 1.05005C2.21386 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V3.65005C14.9498 2.21411 13.7857 1.05005 12.3498 1.05005H3.6498ZM5.4002 2.25005H3.6498C2.87661 2.25005 2.2498 2.87685 2.2498 3.65005V5.40002H5.4002V2.25005ZM2.2498 10.6V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H5.4002V10.6H2.2498ZM6.60019 13.75H9.4002V9.40002H13.7498V6.60002H9.4002V2.25005H6.60019V6.60002H2.25029V9.40002H6.60019V13.75ZM10.6002 2.25005V5.40002H13.7498V3.65005C13.7498 2.87685 13.123 2.25005 12.3498 2.25005H10.6002ZM13.7498 10.6H10.6002V13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.6Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Y=C.forwardRef(function(n,e){return C.createElement(D,Object.assign({},n,{id:"cross-highlighting-single",ref:e,icon:se}))});Y.displayName="CrossHighlightingSingle";const j=["rgba(158, 109, 227, 0.3)","rgba(254, 75, 75, 0.3)","rgba(255, 140, 81, 0.3)","rgba(164, 220, 22, 0.3)","rgba(45, 174, 255, 0.3)","rgba(58, 96, 247, 0.3)","rgba(242, 72, 166, 0.3)","rgba(153, 153, 153, 0.3)","rgba(158, 109, 227, 0.15)","rgba(254, 75, 75, 0.15)","rgba(255, 140, 81, 0.15)","rgba(164, 220, 22, 0.15)","rgba(45, 174, 255, 0.15)","rgba(58, 96, 247, 0.15)","rgba(242, 72, 166, 0.15)","rgba(153, 153, 153, 0.15)"];class S extends a.Disposable{constructor(){super(...arguments);g(this,"_enabled$",new _.BehaviorSubject(!1));g(this,"enabled$",this._enabled$.asObservable());g(this,"_color$",new _.BehaviorSubject(j[0]));g(this,"color$",this._color$.asObservable())}get enabled(){return this._enabled$.getValue()}get color(){return this._color$.getValue()}dispose(){this._enabled$.complete()}setEnabled(t){this._enabled$.next(t)}setColor(t){this._color$.next(t)}}const E={id:"sheet.operation.toggle-crosshair-highlight",type:a.CommandType.OPERATION,handler(n){const e=n.get(S),t=e.enabled;return e.setEnabled(!t),!0}},N={id:"sheet.operation.set-crosshair-highlight-color",type:a.CommandType.OPERATION,handler(n,{value:e}){const t=n.get(S);return t.enabled||t.setEnabled(!0),t.setColor(e),!0}},k={id:"sheet.operation.enable-crosshair-highlight",type:a.CommandType.OPERATION,handler(n){const e=n.get(S);return e.enabled?!1:(e.setEnabled(!0),!0)}},B={id:"sheet.operation.disable-crosshair-highlight",type:a.CommandType.OPERATION,handler(n){const e=n.get(S);return e.enabled?(e.setEnabled(!1),!0):!1}};var y={exports:{}},R={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var L;function oe(){if(L)return R;L=1;var n=C,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(c,l,p){var h,f={},v=null,d=null;p!==void 0&&(v=""+p),l.key!==void 0&&(v=""+l.key),l.ref!==void 0&&(d=l.ref);for(h in l)r.call(l,h)&&!s.hasOwnProperty(h)&&(f[h]=l[h]);if(c&&c.defaultProps)for(h in l=c.defaultProps,l)f[h]===void 0&&(f[h]=l[h]);return{$$typeof:e,type:c,key:v,ref:d,props:f,_owner:i.current}}return R.Fragment=t,R.jsx=o,R.jsxs=o,R}var G;function ae(){return G||(G=1,y.exports=oe()),y.exports}var U=ae();function Z(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=Z(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function ce(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=Z(n))&&(r&&(r+=" "),r+=e);return r}const le="univer-crosshair-highlight-overlay",he="univer-crosshair-highlight-item",ge="univer-crosshair-highlight-item-selected",T={crosshairHighlightOverlay:le,crosshairHighlightItem:he,crosshairHighlightItemSelected:ge};function ue(n){const{onChange:e}=n,t=a.useDependency(S),r=a.useObservable(t.color$),i=C.useCallback(s=>{e==null||e(s)},[e]);return U.jsx("div",{className:T.crosshairHighlightOverlay,children:j.map(s=>U.jsx("div",{className:ce(T.crosshairHighlightItem,{[T.crosshairHighlightItemSelected]:s===r}),style:{backgroundColor:s},onClick:()=>i(s)},s))})}const F="CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";function de(n){const e=n.get(S);return{id:E.id,tooltip:"crosshair.button.tooltip",type:m.MenuItemType.BUTTON_SELECTOR,icon:"CrossHighlightingSingle",selections:[{label:{name:F,hoverable:!1}}],selectionsCommandId:N.id,activated$:e.enabled$,hidden$:m.getMenuHiddenObservable(n,a.UniverInstanceType.UNIVER_SHEET)}}const fe={[m.ContextMenuPosition.FOOTER_MENU]:{[m.ContextMenuGroup.OTHERS]:{[E.id]:{order:0,menuItemFactory:de}}}};var _e=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,pe=(n,e,t,r)=>{for(var i=r>1?void 0:r?Se(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&_e(e,t,i),i},w=(n,e)=>(t,r)=>e(t,r,n);let O=class extends a.Disposable{constructor(n,e,t){super(),this._componentMgr=n,this._menuManagerService=e,this._cmdSrv=t,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[E,N,k,B].forEach(n=>this._cmdSrv.registerCommand(n))}_initMenus(){this._menuManagerService.mergeMenu(fe)}_initComponents(){this._componentMgr.register(F,ue),this._componentMgr.register("CrossHighlightingSingle",Y)}};O=pe([w(0,a.Inject(m.ComponentManager)),w(1,m.IMenuManagerService),w(2,a.ICommandService)],O);const ve=1;class Ce{constructor(){g(this,"_selectedRanges",[]);g(this,"_ranges",[])}addRange(e){if(e.rangeType===a.RANGE_TYPE.COLUMN||e.rangeType===a.RANGE_TYPE.ROW||e.rangeType===a.RANGE_TYPE.ALL)return;const t=this._getIntersects(e),r=this._getSplitRanges(e,t);r.length>0&&this._ranges.push(...r)}setSelectedRanges(e){this._selectedRanges=e}_getSplitRanges(e,t){let r=[e];for(const i of t.concat(this._selectedRanges)){const s=[];for(const o of r){const c=a.Rectangle.subtract(o,i);c&&c.length>0&&s.push(...c)}r=s}return r.filter(i=>i.startRow<=i.endRow&&i.startColumn<=i.endColumn)}_getIntersects(e){const t=[];for(const r of this._ranges){const i=a.Rectangle.getIntersects(r,e);i&&t.push(i)}return t}getRanges(){return this._ranges}reset(){this._ranges=[],this._selectedRanges=[]}}class me extends P.Shape{constructor(t,r){super(t,r);g(this,"_color");r&&this.setShapeProps(r)}setShapeProps(t){typeof t.color<"u"&&(this._color=t.color),this.transformByState({width:t.width,height:t.height})}_draw(t){const r=`rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${this._color.a})`;P.Rect.drawWith(t,{width:this.width,height:this.height,fill:r,stroke:void 0,strokeWidth:0,evented:!1})}}var Re=Object.defineProperty,be=Object.getOwnPropertyDescriptor,He=(n,e,t,r)=>{for(var i=r>1?void 0:r?be(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Re(e,t,i),i},b=(n,e)=>(t,r)=>e(t,r,n);let I=class extends a.Disposable{constructor(e,t,r,i,s,o){super();g(this,"_shapes",[]);g(this,"_rangeCollection",new Ce);g(this,"_color","rgba(255,0,0,0.5)");this._context=e,this._sheetSkeletonManagerService=t,this._sheetsSelectionsService=r,this._sheetsCrosshairHighlightService=i,this._contextService=s,this._refSelectionsService=o,this._initRenderListener()}_transformSelection(e,t){if(!e)return;const r=t.getRowCount(),i=t.getColumnCount(),s=[];for(const o of e){const{startRow:c,endRow:l,startColumn:p,endColumn:h}=o.range;l-c+1===r||h-p+1===i||s.push(o.range)}this._rangeCollection.setSelectedRanges(s);for(const o of s)this.addSelection(o,t)}_initRenderListener(){const e=this._context.unit;this.disposeWithMe(_.combineLatest([this._contextService.subscribeContextValue$($.REF_SELECTIONS_ENABLED).pipe(_.startWith(!1)),this._sheetSkeletonManagerService.currentSkeleton$,this._sheetsCrosshairHighlightService.enabled$,this._sheetsCrosshairHighlightService.color$.pipe(_.tap(t=>this._color=t)),_.merge(this._sheetsSelectionsService.selectionMoveStart$,this._sheetsSelectionsService.selectionMoving$,this._sheetsSelectionsService.selectionMoveEnd$,this._sheetsSelectionsService.selectionSet$,e.activeSheet$.pipe(_.map(()=>this._sheetsSelectionsService.getCurrentSelections()))),_.merge(this._refSelectionsService.selectionMoveStart$,this._refSelectionsService.selectionMoving$,this._refSelectionsService.selectionMoveEnd$,this._sheetsSelectionsService.selectionSet$,e.activeSheet$.pipe(_.map(()=>this._refSelectionsService.getCurrentSelections())))]).subscribe(([t,r,i,s,o,c])=>{if(this._clear(),!i)return;const l=t?c:o;this._rangeCollection.reset(),this._transformSelection(l,e.getActiveSheet()),this.render(this._rangeCollection.getRanges())}))}addSelection(e,t){if(e.rangeType===a.RANGE_TYPE.COLUMN||e.rangeType===a.RANGE_TYPE.ROW||e.rangeType===a.RANGE_TYPE.ALL)return;const r=t.getRowCount(),i=t.getColumnCount(),{startRow:s,endRow:o,startColumn:c,endColumn:l}=e,p={startRow:s,endRow:o,startColumn:0,endColumn:c-1},h={startRow:s,endRow:o,startColumn:l+1,endColumn:i},f={startRow:0,endRow:s-1,startColumn:c,endColumn:l},v={startRow:o+1,endRow:r,startColumn:c,endColumn:l};for(const d of[p,h,f,v])d.startRow<=d.endRow&&d.startColumn<=d.endColumn&&this._rangeCollection.addRange(d)}_clear(){this._shapes.forEach(e=>{e.dispose()}),this._shapes=[]}_addShapes(e,t,r,i){const{startRow:s,endRow:o,startColumn:c,endColumn:l}=e,p=M.getCoordByCell(s,c,r,i),h=M.getCoordByCell(o,l,r,i),{startX:f,startY:v}=p,{endX:d,endY:W}=h,J=d-f,X=W-v,K={left:f,top:v,color:new a.ColorKit(this._color).toRgb(),width:J,height:X,zIndex:ve,evented:!1},V=new me(`crosshair-${t}`,K);this._shapes.push(V),r.addObject(V)}render(e){const t=this._sheetSkeletonManagerService.getCurrentSkeleton();if(!t)return;const{scene:r}=this._context;this._clear();for(let i=0;i<e.length;i++){const s=e[i];this._addShapes(s,i,r,t)}r.makeDirty(!0)}async dispose(){super.dispose()}};I=He([b(1,a.Inject(M.SheetSkeletonManagerService)),b(2,a.Inject($.SheetsSelectionsService)),b(3,a.Inject(S)),b(4,a.Inject(a.IContextService)),b(5,$.IRefSelectionsService)],I);var Oe=Object.defineProperty,Ie=Object.getOwnPropertyDescriptor,Ee=(n,e,t,r)=>{for(var i=r>1?void 0:r?Ie(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Oe(e,t,i),i},x=(n,e)=>(t,r)=>e(t,r,n),H;exports.UniverSheetsCrosshairHighlightPlugin=(H=class extends a.Plugin{constructor(e=A,t,r,i){super(),this._config=e,this._injector=t,this._renderManagerService=r,this._configService=i;const{...s}=a.merge({},A,this._config);this._configService.setConfig(ee,s)}onStarting(){[[S],[O]].forEach(e=>this._injector.add(e))}onReady(){[[I]].forEach(e=>this._injector.add(e)),this._injector.get(O),this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SHEET,[I])}},g(H,"pluginName","SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"),g(H,"type",a.UniverInstanceType.UNIVER_SHEET),H);exports.UniverSheetsCrosshairHighlightPlugin=Ee([x(1,a.Inject(a.Injector)),x(2,P.IRenderManagerService),x(3,a.IConfigService)],exports.UniverSheetsCrosshairHighlightPlugin);exports.CROSSHAIR_HIGHLIGHT_COLORS=j;exports.DisableCrosshairHighlightOperation=B;exports.EnableCrosshairHighlightOperation=k;exports.SetCrosshairHighlightColorOperation=N;exports.SheetsCrosshairHighlightService=S;exports.ToggleCrosshairHighlightOperation=E;
|
package/lib/cjs/locale/en-US.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t={crosshair:{button:{tooltip:"Crosshair Highlight"}}};module.exports=t;
|
package/lib/cjs/locale/fa-IR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t={crosshair:{button:{tooltip:"برجسته کردن خط نشانه"}}};module.exports=t;
|
package/lib/cjs/locale/fr-FR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t={crosshair:{button:{tooltip:"Surlignage du réticule"}}};module.exports=t;
|
package/lib/cjs/locale/ru-RU.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t={crosshair:{button:{tooltip:"Перекрестный выделение"}}};module.exports=t;
|
package/lib/cjs/locale/vi-VN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const o={crosshair:{button:{tooltip:"Đánh dấu chéo"}}};module.exports=o;
|
package/lib/cjs/locale/zh-CN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t={crosshair:{button:{tooltip:"十字高亮"}}};module.exports=t;
|
package/lib/cjs/locale/zh-TW.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t={crosshair:{button:{tooltip:"十字高亮"}}};module.exports=t;
|
package/lib/es/facade.js
CHANGED
|
@@ -1,50 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const commandService = injector.get(ICommandService);
|
|
11
|
-
this.disposeWithMe(commandService.onCommandExecuted((commandInfo) => {
|
|
12
|
-
if (commandInfo.id === EnableCrosshairHighlightOperation.id || commandInfo.id === DisableCrosshairHighlightOperation.id) {
|
|
13
|
-
const activeSheet = this.getActiveSheet();
|
|
14
|
-
if (!activeSheet || !this._eventListend(this.Event.CrosshairHighlightEnabledChanged)) return;
|
|
1
|
+
import { FUniver as o, ICommandService as a } from "@univerjs/core";
|
|
2
|
+
import { EnableCrosshairHighlightOperation as h, DisableCrosshairHighlightOperation as r, SetCrosshairHighlightColorOperation as s, SheetsCrosshairHighlightService as n, CROSSHAIR_HIGHLIGHT_COLORS as l } from "@univerjs/sheets-crosshair-highlight";
|
|
3
|
+
class c extends o {
|
|
4
|
+
_initialize(i) {
|
|
5
|
+
const g = i.get(a);
|
|
6
|
+
this.disposeWithMe(g.onCommandExecuted((t) => {
|
|
7
|
+
if (t.id === h.id || t.id === r.id) {
|
|
8
|
+
const e = this.getActiveSheet();
|
|
9
|
+
if (!e || !this._eventListend(this.Event.CrosshairHighlightEnabledChanged)) return;
|
|
15
10
|
this.fireEvent(this.Event.CrosshairHighlightEnabledChanged, {
|
|
16
11
|
enabled: this.getCrosshairHighlightEnabled(),
|
|
17
|
-
...
|
|
12
|
+
...e
|
|
18
13
|
});
|
|
19
14
|
}
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
15
|
+
if (t.id === s.id) {
|
|
16
|
+
const e = this.getActiveSheet();
|
|
17
|
+
if (!e || !this._eventListend(this.Event.CrosshairHighlightColorChanged)) return;
|
|
23
18
|
this.fireEvent(this.Event.CrosshairHighlightColorChanged, {
|
|
24
19
|
color: this.getCrosshairHighlightColor(),
|
|
25
|
-
...
|
|
20
|
+
...e
|
|
26
21
|
});
|
|
27
22
|
}
|
|
28
23
|
}));
|
|
29
24
|
}
|
|
30
|
-
setCrosshairHighlightEnabled(
|
|
31
|
-
return
|
|
25
|
+
setCrosshairHighlightEnabled(i) {
|
|
26
|
+
return i ? this._commandService.syncExecuteCommand(h.id) : this._commandService.syncExecuteCommand(r.id), this;
|
|
32
27
|
}
|
|
33
|
-
setCrosshairHighlightColor(
|
|
34
|
-
return this._commandService.syncExecuteCommand(
|
|
35
|
-
value:
|
|
28
|
+
setCrosshairHighlightColor(i) {
|
|
29
|
+
return this._commandService.syncExecuteCommand(s.id, {
|
|
30
|
+
value: i
|
|
36
31
|
}), this;
|
|
37
32
|
}
|
|
38
33
|
getCrosshairHighlightEnabled() {
|
|
39
|
-
return this._injector.get(
|
|
34
|
+
return this._injector.get(n).enabled;
|
|
40
35
|
}
|
|
41
36
|
getCrosshairHighlightColor() {
|
|
42
|
-
return this._injector.get(
|
|
37
|
+
return this._injector.get(n).color;
|
|
43
38
|
}
|
|
44
39
|
get CROSSHAIR_HIGHLIGHT_COLORS() {
|
|
45
|
-
return
|
|
40
|
+
return l;
|
|
46
41
|
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
let FUniverCrosshairHighlightMixin = _FUniverCrosshairHighlightMixin;
|
|
50
|
-
FUniver.extend(FUniverCrosshairHighlightMixin);
|
|
42
|
+
}
|
|
43
|
+
o.extend(c);
|