@univerjs/sheets-crosshair-highlight 0.4.2-nightly.202411071606 → 0.4.2-nightly.202411091134

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.
@@ -0,0 +1 @@
1
+ "use strict";const r=require("@univerjs/core"),e=require("@univerjs/sheets-crosshair-highlight");class s extends r.FUniver{setCrosshairHighlightEnabled(i){i?this._commandService.executeCommand(e.EnableCrosshairHighlightOperation.id):this._commandService.executeCommand(e.DisableCrosshairHighlightOperation.id)}setCrosshairHighlightColor(i){this._commandService.executeCommand(e.SetCrosshairHighlightColorOperation.id,{value:i})}}r.FUniver.extend(s);
@@ -0,0 +1,9 @@
1
+ "use strict";var K=Object.defineProperty;var z=(n,e,r)=>e in n?K(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r;var l=(n,e,r)=>z(n,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),M=require("@univerjs/engine-render"),v=require("@univerjs/ui"),u=require("rxjs"),_=require("react"),P=require("@univerjs/sheets-ui"),$=require("@univerjs/sheets");var h=function(){return h=Object.assign||function(n){for(var e,r=1,t=arguments.length;r<t;r++){e=arguments[r];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},h.apply(this,arguments)},J=function(n,e){var r={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.indexOf(t)<0&&(r[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,t=Object.getOwnPropertySymbols(n);s<t.length;s++)e.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(n,t[s])&&(r[t[s]]=n[t[s]]);return r},A=_.forwardRef(function(n,e){var r=n.icon,t=n.id,s=n.className,i=n.extend,o=J(n,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(t," ").concat(s||"").trim(),g=_.useRef("_".concat(te()));return L(r,"".concat(t),{defIds:r.defIds,idSuffix:g.current},h({ref:e,className:c},o),i)});function L(n,e,r,t,s){return _.createElement(n.tag,h(h({key:e},Q(n,r,s)),t),(ee(n,r).children||[]).map(function(i,o){return L(i,"".concat(e,"-").concat(n.tag,"-").concat(o),r,void 0,s)}))}function Q(n,e,r){var t=h({},n.attrs);r!=null&&r.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=r.colorChannel1);var s=e.defIds;return!s||s.length===0||(n.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+e.idSuffix),Object.entries(t).forEach(function(i){var o=i[0],c=i[1];typeof c=="string"&&(t[o]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),t}function ee(n,e){var r,t=e.defIds;return!t||t.length===0?n:n.tag==="defs"&&(!((r=n.children)===null||r===void 0)&&r.length)?h(h({},n),{children:n.children.map(function(s){return typeof s.attrs.id=="string"&&t&&t.indexOf(s.attrs.id)>-1?h(h({},s),{attrs:h(h({},s.attrs),{id:s.attrs.id+e.idSuffix})}):s})}):n}function te(){return Math.random().toString(36).substring(2,8)}A.displayName="UniverIcon";var re={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"}}]},G=_.forwardRef(function(n,e){return _.createElement(A,Object.assign({},n,{id:"cross-highlighting-single",ref:e,icon:re}))});G.displayName="CrossHighlightingSingle";const x=["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 d extends a.Disposable{constructor(){super(...arguments);l(this,"_enabled$",new u.BehaviorSubject(!1));l(this,"enabled$",this._enabled$.asObservable());l(this,"_color$",new u.BehaviorSubject(x[0]));l(this,"color$",this._color$.asObservable())}get enabled(){return this._enabled$.getValue()}get color(){return this._color$.getValue()}dispose(){this._enabled$.complete()}setEnabled(r){this._enabled$.next(r)}setColor(r){this._color$.next(r)}}const I={id:"sheet.operation.toggle-crosshair-highlight",type:a.CommandType.OPERATION,handler(n){const e=n.get(d),r=e.enabled;return e.setEnabled(!r),!0}},j={id:"sheet.operation.set-crosshair-highlight-color",type:a.CommandType.OPERATION,handler(n,{value:e}){const r=n.get(d);return r.enabled||r.setEnabled(!0),r.setColor(e),!0}},U={id:"sheet.operation.enable-crosshair-highlight",type:a.CommandType.OPERATION,handler(n){const e=n.get(d);return e.enabled?!1:(e.setEnabled(!0),!0)}},D={id:"sheet.operation.disable-crosshair-highlight",type:a.CommandType.OPERATION,handler(n){const e=n.get(d);return e.enabled?(e.setEnabled(!1),!0):!1}};var Y={exports:{}},y={};/**
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 ne=_,se=Symbol.for("react.element"),ie=Symbol.for("react.fragment"),oe=Object.prototype.hasOwnProperty,ae=ne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ce={key:!0,ref:!0,__self:!0,__source:!0};function k(n,e,r){var t,s={},i=null,o=null;r!==void 0&&(i=""+r),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(t in e)oe.call(e,t)&&!ce.hasOwnProperty(t)&&(s[t]=e[t]);if(n&&n.defaultProps)for(t in e=n.defaultProps,e)s[t]===void 0&&(s[t]=e[t]);return{$$typeof:se,type:n,key:i,ref:o,props:s,_owner:ae.current}}y.Fragment=ie;y.jsx=k;y.jsxs=k;Y.exports=y;var V=Y.exports;function B(n){var e,r,t="";if(typeof n=="string"||typeof n=="number")t+=n;else if(typeof n=="object")if(Array.isArray(n)){var s=n.length;for(e=0;e<s;e++)n[e]&&(r=B(n[e]))&&(t&&(t+=" "),t+=r)}else for(r in n)n[r]&&(t&&(t+=" "),t+=r);return t}function le(){for(var n,e,r=0,t="",s=arguments.length;r<s;r++)(n=arguments[r])&&(e=B(n))&&(t&&(t+=" "),t+=e);return t}const he="univer-crosshair-highlight-overlay",ge="univer-crosshair-highlight-item",ue="univer-crosshair-highlight-item-selected",E={crosshairHighlightOverlay:he,crosshairHighlightItem:ge,crosshairHighlightItemSelected:ue};function de(n){const{onChange:e}=n,r=a.useDependency(d),t=a.useObservable(r.color$),s=_.useCallback(i=>{e==null||e(i)},[e]);return V.jsx("div",{className:E.crosshairHighlightOverlay,children:x.map(i=>V.jsx("div",{className:le(E.crosshairHighlightItem,{[E.crosshairHighlightItemSelected]:i===t}),style:{backgroundColor:i},onClick:()=>s(i)},i))})}const q="CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";function fe(n){const e=n.get(d);return{id:I.id,tooltip:"crosshair.button.tooltip",type:v.MenuItemType.BUTTON_SELECTOR,icon:"CrossHighlightingSingle",selections:[{label:{name:q,hoverable:!1}}],selectionsCommandId:j.id,activated$:e.enabled$,hidden$:v.getMenuHiddenObservable(n,a.UniverInstanceType.UNIVER_SHEET)}}const _e={[v.ContextMenuPosition.FOOTER_MENU]:{[v.ContextMenuGroup.OTHERS]:{[I.id]:{order:0,menuItemFactory:fe}}}};var ve=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,pe=(n,e,r,t)=>{for(var s=t>1?void 0:t?Se(e,r):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(t?o(e,r,s):o(s))||s);return t&&s&&ve(e,r,s),s},w=(n,e)=>(r,t)=>e(r,t,n);let H=class extends a.Disposable{constructor(n,e,r){super(),this._componentMgr=n,this._menuManagerService=e,this._cmdSrv=r,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[I,j,U,D].forEach(n=>this._cmdSrv.registerCommand(n))}_initMenus(){this._menuManagerService.mergeMenu(_e)}_initComponents(){this._componentMgr.register(q,de),this._componentMgr.register("CrossHighlightingSingle",G)}};H=pe([w(0,a.Inject(v.ComponentManager)),w(1,v.IMenuManagerService),w(2,a.ICommandService)],H);const Ce=1;class me{constructor(){l(this,"_selectedRanges",[]);l(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 r=this._getIntersects(e),t=this._getSplitRanges(e,r);t.length>0&&this._ranges.push(...t)}setSelectedRanges(e){this._selectedRanges=e}_getSplitRanges(e,r){let t=[e];for(const s of r.concat(this._selectedRanges)){const i=[];for(const o of t){const c=a.Rectangle.subtract(o,s);c&&c.length>0&&i.push(...c)}t=i}return t.filter(s=>s.startRow<=s.endRow&&s.startColumn<=s.endColumn)}_getIntersects(e){const r=[];for(const t of this._ranges){const s=a.Rectangle.getIntersects(t,e);s&&r.push(s)}return r}getRanges(){return this._ranges}reset(){this._ranges=[],this._selectedRanges=[]}}class be extends M.Shape{constructor(r,t){super(r,t);l(this,"_color");t&&this.setShapeProps(t)}setShapeProps(r){typeof r.color<"u"&&(this._color=r.color),this.transformByState({width:r.width,height:r.height})}_draw(r){const t=`rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${this._color.a})`;M.Rect.drawWith(r,{width:this.width,height:this.height,fill:t,stroke:void 0,strokeWidth:0,evented:!1})}}var Re=Object.defineProperty,He=Object.getOwnPropertyDescriptor,Oe=(n,e,r,t)=>{for(var s=t>1?void 0:t?He(e,r):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(t?o(e,r,s):o(s))||s);return t&&s&&Re(e,r,s),s},C=(n,e)=>(r,t)=>e(r,t,n);let O=class extends a.Disposable{constructor(e,r,t,s,i,o){super();l(this,"_shapes",[]);l(this,"_rangeCollection",new me);l(this,"_color","rgba(255,0,0,0.5)");this._context=e,this._sheetSkeletonManagerService=r,this._sheetsSelectionsService=t,this._sheetsCrosshairHighlightService=s,this._contextService=i,this._refSelectionsService=o,this._initRenderListener()}_transformSelection(e,r){if(!e)return;const t=r.getRowCount(),s=r.getColumnCount(),i=[];for(const o of e){const{startRow:c,endRow:g,startColumn:S,endColumn:p}=o.range;g-c+1===t||p-S+1===s||i.push(o.range)}this._rangeCollection.setSelectedRanges(i);for(const o of i)this.addSelection(o,r)}_initRenderListener(){const e=this._context.unit;this.disposeWithMe(u.combineLatest([this._contextService.subscribeContextValue$($.DISABLE_NORMAL_SELECTIONS).pipe(u.startWith(!1)),this._sheetSkeletonManagerService.currentSkeleton$,this._sheetsCrosshairHighlightService.enabled$,this._sheetsCrosshairHighlightService.color$.pipe(u.tap(r=>this._color=r)),u.merge(this._sheetsSelectionsService.selectionMoveStart$,this._sheetsSelectionsService.selectionMoving$,this._sheetsSelectionsService.selectionMoveEnd$,e.activeSheet$.pipe(u.map(()=>this._sheetsSelectionsService.getCurrentSelections()))),u.merge(this._refSelectionsService.selectionMoveStart$,this._refSelectionsService.selectionMoving$,this._refSelectionsService.selectionMoveEnd$,e.activeSheet$.pipe(u.map(()=>this._refSelectionsService.getCurrentSelections())))]).subscribe(([r,t,s,i,o,c])=>{if(this._clear(),!s)return;const g=r?c:o;this._rangeCollection.reset(),this._transformSelection(g,e.getActiveSheet()),this.render(this._rangeCollection.getRanges())}))}addSelection(e,r){if(e.rangeType===a.RANGE_TYPE.COLUMN||e.rangeType===a.RANGE_TYPE.ROW||e.rangeType===a.RANGE_TYPE.ALL)return;const t=r.getRowCount(),s=r.getColumnCount(),{startRow:i,endRow:o,startColumn:c,endColumn:g}=e,S={startRow:i,endRow:o,startColumn:0,endColumn:c-1},p={startRow:i,endRow:o,startColumn:g+1,endColumn:s},m={startRow:0,endRow:i-1,startColumn:c,endColumn:g},b={startRow:o+1,endRow:t,startColumn:c,endColumn:g};for(const f of[S,p,m,b])f.startRow<=f.endRow&&f.startColumn<=f.endColumn&&this._rangeCollection.addRange(f)}_clear(){this._shapes.forEach(e=>{e.dispose()}),this._shapes=[]}_addShapes(e,r,t,s){const{startRow:i,endRow:o,startColumn:c,endColumn:g}=e,S=P.getCoordByCell(i,c,t,s),p=P.getCoordByCell(o,g,t,s),{startX:m,startY:b}=S,{endX:f,endY:Z}=p,W=f-m,F=Z-b,X={left:m,top:b,color:new a.ColorKit(this._color).toRgb(),width:W,height:F,zIndex:Ce,evented:!1},N=new be(`crosshair-${r}`,X);this._shapes.push(N),t.addObject(N)}render(e){const r=this._sheetSkeletonManagerService.getCurrentSkeleton();if(!r)return;const{scene:t}=this._context;this._clear();for(let s=0;s<e.length;s++){const i=e[s];this._addShapes(i,s,t,r)}t.makeDirty(!0)}async dispose(){super.dispose()}};O=Oe([C(1,a.Inject(P.SheetSkeletonManagerService)),C(2,a.Inject($.SheetsSelectionsService)),C(3,a.Inject(d)),C(4,a.Inject(a.IContextService)),C(5,$.IRefSelectionsService)],O);const Ie="sheets-crosshair-highlight.config",ye={};var Ee=Object.defineProperty,we=Object.getOwnPropertyDescriptor,Te=(n,e,r,t)=>{for(var s=t>1?void 0:t?we(e,r):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(t?o(e,r,s):o(s))||s);return t&&s&&Ee(e,r,s),s},T=(n,e)=>(r,t)=>e(r,t,n),R;exports.UniverSheetsCrosshairHighlightPlugin=(R=class extends a.Plugin{constructor(e=ye,r,t,s){super(),this._config=e,this._injector=r,this._renderManagerService=t,this._configService=s;const{...i}=this._config;this._configService.setConfig(Ie,i)}onStarting(){[[d],[H]].forEach(e=>this._injector.add(e))}onReady(){[[O]].forEach(e=>this._injector.add(e)),this._injector.get(H),this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SHEET,[O])}},l(R,"pluginName","SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"),l(R,"type",a.UniverInstanceType.UNIVER_SHEET),R);exports.UniverSheetsCrosshairHighlightPlugin=Te([T(1,a.Inject(a.Injector)),T(2,M.IRenderManagerService),T(3,a.IConfigService)],exports.UniverSheetsCrosshairHighlightPlugin);exports.CROSSHAIR_HIGHLIGHT_COLORS=x;exports.DisableCrosshairHighlightOperation=D;exports.EnableCrosshairHighlightOperation=U;exports.SetCrosshairHighlightColorOperation=j;exports.ToggleCrosshairHighlightOperation=I;
@@ -0,0 +1 @@
1
+ "use strict";const t={crosshair:{button:{tooltip:"Crosshair Highlight"}}};module.exports=t;
@@ -0,0 +1 @@
1
+ "use strict";const t={crosshair:{button:{tooltip:"برجسته کردن خط نشانه"}}};module.exports=t;
@@ -0,0 +1 @@
1
+ "use strict";const t={crosshair:{button:{tooltip:"Перекрестный выделение"}}};module.exports=t;
@@ -0,0 +1 @@
1
+ "use strict";const o={crosshair:{button:{tooltip:"Đánh dấu chéo"}}};module.exports=o;
@@ -0,0 +1 @@
1
+ "use strict";const t={crosshair:{button:{tooltip:"十字高亮"}}};module.exports=t;
@@ -0,0 +1 @@
1
+ "use strict";const t={crosshair:{button:{tooltip:"十字高亮"}}};module.exports=t;
package/lib/es/facade.js CHANGED
@@ -1,17 +1,13 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
3
- import { FUniver } from "@univerjs/core";
4
- import { E as EnableCrosshairHighlightOperation, D as DisableCrosshairHighlightOperation, a as SetCrosshairHighlightColorOperation } from "../operation-8Cu0xxNn.mjs";
5
- const _FUniverCrosshairHighlightMixin = class _FUniverCrosshairHighlightMixin extends FUniver {
6
- setCrosshairHighlightEnabled(enabled) {
7
- enabled ? this._commandService.executeCommand(EnableCrosshairHighlightOperation.id) : this._commandService.executeCommand(DisableCrosshairHighlightOperation.id);
1
+ import { FUniver as e } from "@univerjs/core";
2
+ import { EnableCrosshairHighlightOperation as r, DisableCrosshairHighlightOperation as o, SetCrosshairHighlightColorOperation as s } from "@univerjs/sheets-crosshair-highlight";
3
+ class t extends e {
4
+ setCrosshairHighlightEnabled(i) {
5
+ i ? this._commandService.executeCommand(r.id) : this._commandService.executeCommand(o.id);
8
6
  }
9
- setCrosshairHighlightColor(color) {
10
- this._commandService.executeCommand(SetCrosshairHighlightColorOperation.id, {
11
- value: color
7
+ setCrosshairHighlightColor(i) {
8
+ this._commandService.executeCommand(s.id, {
9
+ value: i
12
10
  });
13
11
  }
14
- };
15
- __name(_FUniverCrosshairHighlightMixin, "FUniverCrosshairHighlightMixin");
16
- let FUniverCrosshairHighlightMixin = _FUniverCrosshairHighlightMixin;
17
- FUniver.extend(FUniverCrosshairHighlightMixin);
12
+ }
13
+ e.extend(t);
package/lib/es/index.js CHANGED
@@ -1,201 +1,286 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { useDependency, useObservable, UniverInstanceType, Inject, Disposable, ICommandService, RANGE_TYPE, Rectangle, IContextService, ColorKit, Plugin, Injector, IConfigService } from "@univerjs/core";
6
- import { Shape, Rect, IRenderManagerService } from "@univerjs/engine-render";
7
- import { MenuItemType, getMenuHiddenObservable, ContextMenuPosition, ContextMenuGroup, ComponentManager, IMenuManagerService } from "@univerjs/ui";
8
- import { S as SheetsCrosshairHighlightService, C as CROSSHAIR_HIGHLIGHT_COLORS, T as ToggleCrosshairHighlightOperation, a as SetCrosshairHighlightColorOperation, E as EnableCrosshairHighlightOperation, D as DisableCrosshairHighlightOperation } from "../operation-8Cu0xxNn.mjs";
9
- import React, { forwardRef, useRef, createElement, useCallback } from "react";
10
- import { SheetSkeletonManagerService, getCoordByCell } from "@univerjs/sheets-ui";
11
- import { SheetsSelectionsService, DISABLE_NORMAL_SELECTIONS, IRefSelectionsService } from "@univerjs/sheets";
12
- import { combineLatest, startWith, tap, merge, map } from "rxjs";
13
- var __assign = function() {
14
- return __assign = Object.assign || function(t) {
15
- for (var s, i = 1, n = arguments.length; i < n; i++) {
16
- s = arguments[i];
17
- for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
1
+ var ee = Object.defineProperty;
2
+ var te = (n, e, r) => e in n ? ee(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r;
3
+ var c = (n, e, r) => te(n, typeof e != "symbol" ? e + "" : e, r);
4
+ import { Disposable as M, CommandType as O, useDependency as re, useObservable as ne, UniverInstanceType as w, Inject as d, ICommandService as se, RANGE_TYPE as f, Rectangle as P, IContextService as ie, ColorKit as oe, Plugin as ae, Injector as ce, IConfigService as le } from "@univerjs/core";
5
+ import { Shape as he, Rect as ge, IRenderManagerService as ue } from "@univerjs/engine-render";
6
+ import { MenuItemType as de, getMenuHiddenObservable as fe, ContextMenuPosition as _e, ContextMenuGroup as ve, ComponentManager as Se, IMenuManagerService as pe } from "@univerjs/ui";
7
+ import { BehaviorSubject as T, combineLatest as me, startWith as Ce, tap as be, merge as N, map as j } from "rxjs";
8
+ import Re, { forwardRef as G, useRef as Oe, createElement as U, useCallback as He } from "react";
9
+ import { SheetSkeletonManagerService as Ie, getCoordByCell as V } from "@univerjs/sheets-ui";
10
+ import { SheetsSelectionsService as ye, DISABLE_NORMAL_SELECTIONS as Ee, IRefSelectionsService as we } from "@univerjs/sheets";
11
+ var l = function() {
12
+ return l = Object.assign || function(n) {
13
+ for (var e, r = 1, t = arguments.length; r < t; r++) {
14
+ e = arguments[r];
15
+ for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (n[s] = e[s]);
18
16
  }
19
- return t;
20
- }, __assign.apply(this, arguments);
21
- }, __rest = function(s, e) {
22
- var t = {};
23
- for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
24
- if (s != null && typeof Object.getOwnPropertySymbols == "function")
25
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
26
- e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
27
- return t;
28
- }, IconBase = forwardRef(function(props, ref) {
29
- 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 = useRef("_".concat(generateShortUuid()));
30
- return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
17
+ return n;
18
+ }, l.apply(this, arguments);
19
+ }, Me = function(n, e) {
20
+ var r = {};
21
+ for (var t in n) Object.prototype.hasOwnProperty.call(n, t) && e.indexOf(t) < 0 && (r[t] = n[t]);
22
+ if (n != null && typeof Object.getOwnPropertySymbols == "function")
23
+ for (var s = 0, t = Object.getOwnPropertySymbols(n); s < t.length; s++)
24
+ e.indexOf(t[s]) < 0 && Object.prototype.propertyIsEnumerable.call(n, t[s]) && (r[t[s]] = n[t[s]]);
25
+ return r;
26
+ }, D = G(function(n, e) {
27
+ var r = n.icon, t = n.id, s = n.className, i = n.extend, o = Me(n, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(s || "").trim(), h = Oe("_".concat(Pe()));
28
+ return k(r, "".concat(t), { defIds: r.defIds, idSuffix: h.current }, l({ ref: e, className: a }, o), i);
31
29
  });
32
- function render(node, id, runtimeProps, rootProps, extend) {
33
- return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
34
- return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
30
+ function k(n, e, r, t, s) {
31
+ return U(n.tag, l(l({ key: e }, $e(n, r, s)), t), (xe(n, r).children || []).map(function(i, o) {
32
+ return k(i, "".concat(e, "-").concat(n.tag, "-").concat(o), r, void 0, s);
35
33
  }));
36
34
  }
37
- __name(render, "render");
38
- function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
39
- var attrs = __assign({}, node.attrs);
40
- extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
41
- var defIds = runtimeProps.defIds;
42
- 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) {
43
- var key = _a4[0], value = _a4[1];
44
- typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
45
- })), attrs;
35
+ function $e(n, e, r) {
36
+ var t = l({}, n.attrs);
37
+ r != null && r.colorChannel1 && t.fill === "colorChannel1" && (t.fill = r.colorChannel1);
38
+ var s = e.defIds;
39
+ return !s || s.length === 0 || (n.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(i) {
40
+ var o = i[0], a = i[1];
41
+ typeof a == "string" && (t[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
42
+ })), t;
46
43
  }
47
- __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
48
- function replaceRuntimeIdsInDefs(node, runtimeProps) {
49
- var _a4, defIds = runtimeProps.defIds;
50
- 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) {
51
- 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;
52
- }) }) : node;
44
+ function xe(n, e) {
45
+ var r, t = e.defIds;
46
+ return !t || t.length === 0 ? n : n.tag === "defs" && (!((r = n.children) === null || r === void 0) && r.length) ? l(l({}, n), { children: n.children.map(function(s) {
47
+ return typeof s.attrs.id == "string" && t && t.indexOf(s.attrs.id) > -1 ? l(l({}, s), { attrs: l(l({}, s.attrs), { id: s.attrs.id + e.idSuffix }) }) : s;
48
+ }) }) : n;
53
49
  }
54
- __name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
55
- function generateShortUuid() {
50
+ function Pe() {
56
51
  return Math.random().toString(36).substring(2, 8);
57
52
  }
58
- __name(generateShortUuid, "generateShortUuid");
59
- IconBase.displayName = "UniverIcon";
60
- 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 = forwardRef(function(props, ref) {
61
- return createElement(IconBase, Object.assign({}, props, {
53
+ D.displayName = "UniverIcon";
54
+ var Te = { 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" } }] }, Z = G(function(n, e) {
55
+ return U(D, Object.assign({}, n, {
62
56
  id: "cross-highlighting-single",
63
- ref,
64
- icon: element
57
+ ref: e,
58
+ icon: Te
65
59
  }));
66
60
  });
67
- CrossHighlightingSingle.displayName = "CrossHighlightingSingle";
68
- function r(e) {
69
- var t, f, n = "";
70
- if (typeof e == "string" || typeof e == "number") n += e;
71
- else if (typeof e == "object") if (Array.isArray(e)) {
72
- var o = e.length;
73
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
74
- } else for (f in e) e[f] && (n && (n += " "), n += f);
75
- return n;
61
+ Z.displayName = "CrossHighlightingSingle";
62
+ const B = [
63
+ "rgba(158, 109, 227, 0.3)",
64
+ "rgba(254, 75, 75, 0.3)",
65
+ "rgba(255, 140, 81, 0.3)",
66
+ "rgba(164, 220, 22, 0.3)",
67
+ "rgba(45, 174, 255, 0.3)",
68
+ "rgba(58, 96, 247, 0.3)",
69
+ "rgba(242, 72, 166, 0.3)",
70
+ "rgba(153, 153, 153, 0.3)",
71
+ "rgba(158, 109, 227, 0.15)",
72
+ "rgba(254, 75, 75, 0.15)",
73
+ "rgba(255, 140, 81, 0.15)",
74
+ "rgba(164, 220, 22, 0.15)",
75
+ "rgba(45, 174, 255, 0.15)",
76
+ "rgba(58, 96, 247, 0.15)",
77
+ "rgba(242, 72, 166, 0.15)",
78
+ "rgba(153, 153, 153, 0.15)"
79
+ ];
80
+ class g extends M {
81
+ constructor() {
82
+ super(...arguments);
83
+ c(this, "_enabled$", new T(!1));
84
+ c(this, "enabled$", this._enabled$.asObservable());
85
+ c(this, "_color$", new T(B[0]));
86
+ c(this, "color$", this._color$.asObservable());
87
+ }
88
+ get enabled() {
89
+ return this._enabled$.getValue();
90
+ }
91
+ get color() {
92
+ return this._color$.getValue();
93
+ }
94
+ dispose() {
95
+ this._enabled$.complete();
96
+ }
97
+ setEnabled(r) {
98
+ this._enabled$.next(r);
99
+ }
100
+ setColor(r) {
101
+ this._color$.next(r);
102
+ }
103
+ }
104
+ const $ = {
105
+ id: "sheet.operation.toggle-crosshair-highlight",
106
+ type: O.OPERATION,
107
+ handler(n) {
108
+ const e = n.get(g), r = e.enabled;
109
+ return e.setEnabled(!r), !0;
110
+ }
111
+ }, W = {
112
+ id: "sheet.operation.set-crosshair-highlight-color",
113
+ type: O.OPERATION,
114
+ handler(n, { value: e }) {
115
+ const r = n.get(g);
116
+ return r.enabled || r.setEnabled(!0), r.setColor(e), !0;
117
+ }
118
+ }, Ne = {
119
+ id: "sheet.operation.enable-crosshair-highlight",
120
+ type: O.OPERATION,
121
+ handler(n) {
122
+ const e = n.get(g);
123
+ return e.enabled ? !1 : (e.setEnabled(!0), !0);
124
+ }
125
+ }, je = {
126
+ id: "sheet.operation.disable-crosshair-highlight",
127
+ type: O.OPERATION,
128
+ handler(n) {
129
+ const e = n.get(g);
130
+ return e.enabled ? (e.setEnabled(!1), !0) : !1;
131
+ }
132
+ };
133
+ var Y = { exports: {} }, H = {};
134
+ /**
135
+ * @license React
136
+ * react-jsx-runtime.production.min.js
137
+ *
138
+ * Copyright (c) Facebook, Inc. and its affiliates.
139
+ *
140
+ * This source code is licensed under the MIT license found in the
141
+ * LICENSE file in the root directory of this source tree.
142
+ */
143
+ var Ve = Re, Le = Symbol.for("react.element"), Ae = Symbol.for("react.fragment"), Ge = Object.prototype.hasOwnProperty, Ue = Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, De = { key: !0, ref: !0, __self: !0, __source: !0 };
144
+ function F(n, e, r) {
145
+ var t, s = {}, i = null, o = null;
146
+ r !== void 0 && (i = "" + r), e.key !== void 0 && (i = "" + e.key), e.ref !== void 0 && (o = e.ref);
147
+ for (t in e) Ge.call(e, t) && !De.hasOwnProperty(t) && (s[t] = e[t]);
148
+ if (n && n.defaultProps) for (t in e = n.defaultProps, e) s[t] === void 0 && (s[t] = e[t]);
149
+ return { $$typeof: Le, type: n, key: i, ref: o, props: s, _owner: Ue.current };
76
150
  }
77
- __name(r, "r");
78
- function clsx() {
79
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
80
- return n;
151
+ H.Fragment = Ae;
152
+ H.jsx = F;
153
+ H.jsxs = F;
154
+ Y.exports = H;
155
+ var L = Y.exports;
156
+ function X(n) {
157
+ var e, r, t = "";
158
+ if (typeof n == "string" || typeof n == "number") t += n;
159
+ else if (typeof n == "object") if (Array.isArray(n)) {
160
+ var s = n.length;
161
+ for (e = 0; e < s; e++) n[e] && (r = X(n[e])) && (t && (t += " "), t += r);
162
+ } else for (r in n) n[r] && (t && (t += " "), t += r);
163
+ return t;
164
+ }
165
+ function ke() {
166
+ for (var n, e, r = 0, t = "", s = arguments.length; r < s; r++) (n = arguments[r]) && (e = X(n)) && (t && (t += " "), t += e);
167
+ return t;
81
168
  }
82
- __name(clsx, "clsx");
83
- const crosshairHighlightOverlay = "univer-crosshair-highlight-overlay", crosshairHighlightItem = "univer-crosshair-highlight-item", crosshairHighlightItemSelected = "univer-crosshair-highlight-item-selected", styles = {
84
- crosshairHighlightOverlay,
85
- crosshairHighlightItem,
86
- crosshairHighlightItemSelected
169
+ const Ze = "univer-crosshair-highlight-overlay", Be = "univer-crosshair-highlight-item", We = "univer-crosshair-highlight-item-selected", I = {
170
+ crosshairHighlightOverlay: Ze,
171
+ crosshairHighlightItem: Be,
172
+ crosshairHighlightItemSelected: We
87
173
  };
88
- function CrosshairOverlay(props) {
89
- const { onChange } = props, crosshairSrv = useDependency(SheetsCrosshairHighlightService), currentColor = useObservable(crosshairSrv.color$), handleColorPicked = useCallback((color) => {
90
- onChange == null || onChange(color);
91
- }, [onChange]);
92
- return /* @__PURE__ */ React.createElement("div", { className: styles.crosshairHighlightOverlay }, CROSSHAIR_HIGHLIGHT_COLORS.map((color) => /* @__PURE__ */ React.createElement(
174
+ function Ye(n) {
175
+ const { onChange: e } = n, r = re(g), t = ne(r.color$), s = He((i) => {
176
+ e == null || e(i);
177
+ }, [e]);
178
+ return /* @__PURE__ */ L.jsx("div", { className: I.crosshairHighlightOverlay, children: B.map((i) => /* @__PURE__ */ L.jsx(
93
179
  "div",
94
180
  {
95
- key: color,
96
- className: clsx(styles.crosshairHighlightItem, {
97
- [styles.crosshairHighlightItemSelected]: color === currentColor
181
+ className: ke(I.crosshairHighlightItem, {
182
+ [I.crosshairHighlightItemSelected]: i === t
98
183
  }),
99
- style: { backgroundColor: color },
100
- onClick: /* @__PURE__ */ __name(() => handleColorPicked(color), "onClick")
101
- }
102
- )));
184
+ style: { backgroundColor: i },
185
+ onClick: () => s(i)
186
+ },
187
+ i
188
+ )) });
103
189
  }
104
- __name(CrosshairOverlay, "CrosshairOverlay");
105
- const CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT = "CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";
106
- function CrosshairHighlightMenuItemFactory(accessor) {
107
- const crosshairHighlightService = accessor.get(SheetsCrosshairHighlightService);
190
+ const q = "CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";
191
+ function Fe(n) {
192
+ const e = n.get(g);
108
193
  return {
109
- id: ToggleCrosshairHighlightOperation.id,
194
+ id: $.id,
110
195
  tooltip: "crosshair.button.tooltip",
111
- type: MenuItemType.BUTTON_SELECTOR,
196
+ type: de.BUTTON_SELECTOR,
112
197
  icon: "CrossHighlightingSingle",
113
198
  selections: [
114
199
  {
115
200
  label: {
116
- name: CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT,
201
+ name: q,
117
202
  hoverable: !1
118
203
  }
119
204
  }
120
205
  ],
121
- selectionsCommandId: SetCrosshairHighlightColorOperation.id,
122
- activated$: crosshairHighlightService.enabled$,
123
- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)
206
+ selectionsCommandId: W.id,
207
+ activated$: e.enabled$,
208
+ hidden$: fe(n, w.UNIVER_SHEET)
124
209
  };
125
210
  }
126
- __name(CrosshairHighlightMenuItemFactory, "CrosshairHighlightMenuItemFactory");
127
- const menuSchema = {
128
- [ContextMenuPosition.FOOTER_MENU]: {
129
- [ContextMenuGroup.OTHERS]: {
130
- [ToggleCrosshairHighlightOperation.id]: {
211
+ const Xe = {
212
+ [_e.FOOTER_MENU]: {
213
+ [ve.OTHERS]: {
214
+ [$.id]: {
131
215
  order: 0,
132
- menuItemFactory: CrosshairHighlightMenuItemFactory
216
+ menuItemFactory: Fe
133
217
  }
134
218
  }
135
219
  }
136
220
  };
137
- var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
138
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
139
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
140
- return kind && result && __defProp$2(target, key, result), result;
141
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a;
142
- let SheetsCrosshairHighlightController = (_a = class extends Disposable {
143
- constructor(_componentMgr, _menuManagerService, _cmdSrv) {
144
- super(), this._componentMgr = _componentMgr, this._menuManagerService = _menuManagerService, this._cmdSrv = _cmdSrv, this._initCommands(), this._initMenus(), this._initComponents();
221
+ var qe = Object.defineProperty, Ke = Object.getOwnPropertyDescriptor, ze = (n, e, r, t) => {
222
+ for (var s = t > 1 ? void 0 : t ? Ke(e, r) : e, i = n.length - 1, o; i >= 0; i--)
223
+ (o = n[i]) && (s = (t ? o(e, r, s) : o(s)) || s);
224
+ return t && s && qe(e, r, s), s;
225
+ }, y = (n, e) => (r, t) => e(r, t, n);
226
+ let b = class extends M {
227
+ constructor(n, e, r) {
228
+ super(), this._componentMgr = n, this._menuManagerService = e, this._cmdSrv = r, this._initCommands(), this._initMenus(), this._initComponents();
145
229
  }
146
230
  _initCommands() {
147
231
  [
148
- ToggleCrosshairHighlightOperation,
149
- SetCrosshairHighlightColorOperation,
150
- EnableCrosshairHighlightOperation,
151
- DisableCrosshairHighlightOperation
152
- ].forEach((c) => this._cmdSrv.registerCommand(c));
232
+ $,
233
+ W,
234
+ Ne,
235
+ je
236
+ ].forEach((n) => this._cmdSrv.registerCommand(n));
153
237
  }
154
238
  _initMenus() {
155
- this._menuManagerService.mergeMenu(menuSchema);
239
+ this._menuManagerService.mergeMenu(Xe);
156
240
  }
157
241
  _initComponents() {
158
- this._componentMgr.register(CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT, CrosshairOverlay), this._componentMgr.register("CrossHighlightingSingle", CrossHighlightingSingle);
159
- }
160
- }, __name(_a, "SheetsCrosshairHighlightController"), _a);
161
- SheetsCrosshairHighlightController = __decorateClass$2([
162
- __decorateParam$2(0, Inject(ComponentManager)),
163
- __decorateParam$2(1, IMenuManagerService),
164
- __decorateParam$2(2, ICommandService)
165
- ], SheetsCrosshairHighlightController);
166
- const SHEETS_CROSSHAIR_HIGHLIGHT_Z_INDEX = 1, _CrossHairRangeCollection = class _CrossHairRangeCollection {
242
+ this._componentMgr.register(q, Ye), this._componentMgr.register("CrossHighlightingSingle", Z);
243
+ }
244
+ };
245
+ b = ze([
246
+ y(0, d(Se)),
247
+ y(1, pe),
248
+ y(2, se)
249
+ ], b);
250
+ const Je = 1;
251
+ class Qe {
167
252
  constructor() {
168
- __publicField(this, "_selectedRanges", []);
169
- __publicField(this, "_ranges", []);
253
+ c(this, "_selectedRanges", []);
254
+ c(this, "_ranges", []);
170
255
  }
171
- addRange(range) {
172
- if (range.rangeType === RANGE_TYPE.COLUMN || range.rangeType === RANGE_TYPE.ROW || range.rangeType === RANGE_TYPE.ALL)
256
+ addRange(e) {
257
+ if (e.rangeType === f.COLUMN || e.rangeType === f.ROW || e.rangeType === f.ALL)
173
258
  return;
174
- const intersects = this._getIntersects(range), splitRanges = this._getSplitRanges(range, intersects);
175
- splitRanges.length > 0 && this._ranges.push(...splitRanges);
176
- }
177
- setSelectedRanges(selectedRange) {
178
- this._selectedRanges = selectedRange;
179
- }
180
- _getSplitRanges(range, intersects) {
181
- let splitRanges = [range];
182
- for (const intersect of intersects.concat(this._selectedRanges)) {
183
- const newRanges = [];
184
- for (const splitRange of splitRanges) {
185
- const split = Rectangle.subtract(splitRange, intersect);
186
- split && split.length > 0 && newRanges.push(...split);
259
+ const r = this._getIntersects(e), t = this._getSplitRanges(e, r);
260
+ t.length > 0 && this._ranges.push(...t);
261
+ }
262
+ setSelectedRanges(e) {
263
+ this._selectedRanges = e;
264
+ }
265
+ _getSplitRanges(e, r) {
266
+ let t = [e];
267
+ for (const s of r.concat(this._selectedRanges)) {
268
+ const i = [];
269
+ for (const o of t) {
270
+ const a = P.subtract(o, s);
271
+ a && a.length > 0 && i.push(...a);
187
272
  }
188
- splitRanges = newRanges;
273
+ t = i;
189
274
  }
190
- return splitRanges.filter((range2) => range2.startRow <= range2.endRow && range2.startColumn <= range2.endColumn);
275
+ return t.filter((s) => s.startRow <= s.endRow && s.startColumn <= s.endColumn);
191
276
  }
192
- _getIntersects(addRange) {
193
- const intersects = [];
194
- for (const range of this._ranges) {
195
- const intersect = Rectangle.getIntersects(range, addRange);
196
- intersect && intersects.push(intersect);
277
+ _getIntersects(e) {
278
+ const r = [];
279
+ for (const t of this._ranges) {
280
+ const s = P.getIntersects(t, e);
281
+ s && r.push(s);
197
282
  }
198
- return intersects;
283
+ return r;
199
284
  }
200
285
  getRanges() {
201
286
  return this._ranges;
@@ -203,187 +288,183 @@ const SHEETS_CROSSHAIR_HIGHLIGHT_Z_INDEX = 1, _CrossHairRangeCollection = class
203
288
  reset() {
204
289
  this._ranges = [], this._selectedRanges = [];
205
290
  }
206
- };
207
- __name(_CrossHairRangeCollection, "CrossHairRangeCollection");
208
- let CrossHairRangeCollection = _CrossHairRangeCollection;
209
- const _SheetCrossHairHighlightShape = class _SheetCrossHairHighlightShape extends Shape {
210
- constructor(key, props) {
211
- super(key, props);
291
+ }
292
+ class et extends he {
293
+ constructor(r, t) {
294
+ super(r, t);
212
295
  // protected _showHighLight = false;
213
- __publicField(this, "_color");
214
- props && this.setShapeProps(props);
296
+ c(this, "_color");
297
+ t && this.setShapeProps(t);
215
298
  }
216
- setShapeProps(props) {
217
- typeof props.color < "u" && (this._color = props.color), this.transformByState({
218
- width: props.width,
219
- height: props.height
299
+ setShapeProps(r) {
300
+ typeof r.color < "u" && (this._color = r.color), this.transformByState({
301
+ width: r.width,
302
+ height: r.height
220
303
  });
221
304
  }
222
- _draw(ctx) {
223
- const color = `rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${this._color.a})`;
224
- Rect.drawWith(ctx, {
305
+ _draw(r) {
306
+ const t = `rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${this._color.a})`;
307
+ ge.drawWith(r, {
225
308
  width: this.width,
226
309
  height: this.height,
227
- fill: color,
310
+ fill: t,
228
311
  stroke: void 0,
229
312
  strokeWidth: 0,
230
313
  evented: !1
231
314
  });
232
315
  }
233
- };
234
- __name(_SheetCrossHairHighlightShape, "SheetCrossHairHighlightShape");
235
- let SheetCrossHairHighlightShape = _SheetCrossHairHighlightShape;
236
- var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
237
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
238
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
239
- return kind && result && __defProp$1(target, key, result), result;
240
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a2;
241
- let SheetCrosshairHighlightRenderController = (_a2 = class extends Disposable {
242
- constructor(_context, _sheetSkeletonManagerService, _sheetsSelectionsService, _sheetsCrosshairHighlightService, _contextService, _refSelectionsService) {
316
+ }
317
+ var tt = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, nt = (n, e, r, t) => {
318
+ for (var s = t > 1 ? void 0 : t ? rt(e, r) : e, i = n.length - 1, o; i >= 0; i--)
319
+ (o = n[i]) && (s = (t ? o(e, r, s) : o(s)) || s);
320
+ return t && s && tt(e, r, s), s;
321
+ }, S = (n, e) => (r, t) => e(r, t, n);
322
+ let R = class extends M {
323
+ constructor(e, r, t, s, i, o) {
243
324
  super();
244
- __publicField(this, "_shapes", []);
245
- __publicField(this, "_rangeCollection", new CrossHairRangeCollection());
246
- __publicField(this, "_color", "rgba(255,0,0,0.5)");
247
- this._context = _context, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._sheetsSelectionsService = _sheetsSelectionsService, this._sheetsCrosshairHighlightService = _sheetsCrosshairHighlightService, this._contextService = _contextService, this._refSelectionsService = _refSelectionsService, this._initRenderListener();
325
+ c(this, "_shapes", []);
326
+ c(this, "_rangeCollection", new Qe());
327
+ c(this, "_color", "rgba(255,0,0,0.5)");
328
+ this._context = e, this._sheetSkeletonManagerService = r, this._sheetsSelectionsService = t, this._sheetsCrosshairHighlightService = s, this._contextService = i, this._refSelectionsService = o, this._initRenderListener();
248
329
  }
249
- _transformSelection(selectionData, sheet) {
250
- if (!selectionData)
330
+ _transformSelection(e, r) {
331
+ if (!e)
251
332
  return;
252
- const rowCount = sheet.getRowCount(), columnCount = sheet.getColumnCount(), ranges = [];
253
- for (const selection of selectionData) {
254
- const { startRow, endRow, startColumn, endColumn } = selection.range;
255
- endRow - startRow + 1 === rowCount || endColumn - startColumn + 1 === columnCount || ranges.push(selection.range);
333
+ const t = r.getRowCount(), s = r.getColumnCount(), i = [];
334
+ for (const o of e) {
335
+ const { startRow: a, endRow: h, startColumn: _, endColumn: v } = o.range;
336
+ h - a + 1 === t || v - _ + 1 === s || i.push(o.range);
256
337
  }
257
- this._rangeCollection.setSelectedRanges(ranges);
258
- for (const range of ranges)
259
- this.addSelection(range, sheet);
338
+ this._rangeCollection.setSelectedRanges(i);
339
+ for (const o of i)
340
+ this.addSelection(o, r);
260
341
  }
261
342
  _initRenderListener() {
262
- const workbook = this._context.unit;
263
- this.disposeWithMe(combineLatest([
264
- this._contextService.subscribeContextValue$(DISABLE_NORMAL_SELECTIONS).pipe(startWith(!1)),
343
+ const e = this._context.unit;
344
+ this.disposeWithMe(me([
345
+ this._contextService.subscribeContextValue$(Ee).pipe(Ce(!1)),
265
346
  this._sheetSkeletonManagerService.currentSkeleton$,
266
347
  this._sheetsCrosshairHighlightService.enabled$,
267
- this._sheetsCrosshairHighlightService.color$.pipe(tap((color) => this._color = color)),
268
- merge(
348
+ this._sheetsCrosshairHighlightService.color$.pipe(be((r) => this._color = r)),
349
+ N(
269
350
  this._sheetsSelectionsService.selectionMoveStart$,
270
351
  this._sheetsSelectionsService.selectionMoving$,
271
352
  this._sheetsSelectionsService.selectionMoveEnd$,
272
- workbook.activeSheet$.pipe(map(() => this._sheetsSelectionsService.getCurrentSelections()))
353
+ e.activeSheet$.pipe(j(() => this._sheetsSelectionsService.getCurrentSelections()))
273
354
  ),
274
- merge(
355
+ N(
275
356
  this._refSelectionsService.selectionMoveStart$,
276
357
  this._refSelectionsService.selectionMoving$,
277
358
  this._refSelectionsService.selectionMoveEnd$,
278
- workbook.activeSheet$.pipe(map(() => this._refSelectionsService.getCurrentSelections()))
359
+ e.activeSheet$.pipe(j(() => this._refSelectionsService.getCurrentSelections()))
279
360
  )
280
- ]).subscribe(([normalSelDisabled, _, enabled, _color, normalSelections, refSelection]) => {
281
- if (this._clear(), !enabled) return;
282
- const selections = normalSelDisabled ? refSelection : normalSelections;
283
- this._rangeCollection.reset(), this._transformSelection(selections, workbook.getActiveSheet()), this.render(this._rangeCollection.getRanges());
361
+ ]).subscribe(([r, t, s, i, o, a]) => {
362
+ if (this._clear(), !s) return;
363
+ const h = r ? a : o;
364
+ this._rangeCollection.reset(), this._transformSelection(h, e.getActiveSheet()), this.render(this._rangeCollection.getRanges());
284
365
  }));
285
366
  }
286
- addSelection(range, sheet) {
287
- if (range.rangeType === RANGE_TYPE.COLUMN || range.rangeType === RANGE_TYPE.ROW || range.rangeType === RANGE_TYPE.ALL)
367
+ addSelection(e, r) {
368
+ if (e.rangeType === f.COLUMN || e.rangeType === f.ROW || e.rangeType === f.ALL)
288
369
  return;
289
- const maxRow = sheet.getRowCount(), maxColumn = sheet.getColumnCount(), { startRow, endRow, startColumn, endColumn } = range, left = {
290
- startRow,
291
- endRow,
370
+ const t = r.getRowCount(), s = r.getColumnCount(), { startRow: i, endRow: o, startColumn: a, endColumn: h } = e, _ = {
371
+ startRow: i,
372
+ endRow: o,
292
373
  startColumn: 0,
293
- endColumn: startColumn - 1
294
- }, right = {
295
- startRow,
296
- endRow,
297
- startColumn: endColumn + 1,
298
- endColumn: maxColumn
299
- }, top = {
374
+ endColumn: a - 1
375
+ }, v = {
376
+ startRow: i,
377
+ endRow: o,
378
+ startColumn: h + 1,
379
+ endColumn: s
380
+ }, p = {
300
381
  startRow: 0,
301
- endRow: startRow - 1,
302
- startColumn,
303
- endColumn
304
- }, bottom = {
305
- startRow: endRow + 1,
306
- endRow: maxRow,
307
- startColumn,
308
- endColumn
382
+ endRow: i - 1,
383
+ startColumn: a,
384
+ endColumn: h
385
+ }, m = {
386
+ startRow: o + 1,
387
+ endRow: t,
388
+ startColumn: a,
389
+ endColumn: h
309
390
  };
310
- for (const range2 of [left, right, top, bottom])
311
- range2.startRow <= range2.endRow && range2.startColumn <= range2.endColumn && this._rangeCollection.addRange(range2);
391
+ for (const u of [_, v, p, m])
392
+ u.startRow <= u.endRow && u.startColumn <= u.endColumn && this._rangeCollection.addRange(u);
312
393
  }
313
394
  _clear() {
314
- this._shapes.forEach((shape) => {
315
- shape.dispose();
395
+ this._shapes.forEach((e) => {
396
+ e.dispose();
316
397
  }), this._shapes = [];
317
398
  }
318
- _addShapes(range, index, scene, skeleton) {
319
- const { startRow, endRow, startColumn, endColumn } = range, startPosition = getCoordByCell(startRow, startColumn, scene, skeleton), endPosition = getCoordByCell(endRow, endColumn, scene, skeleton), { startX, startY } = startPosition, { endX, endY } = endPosition, width = endX - startX, height = endY - startY, shapeProps = {
320
- left: startX,
321
- top: startY,
322
- color: new ColorKit(this._color).toRgb(),
323
- width,
324
- height,
325
- zIndex: SHEETS_CROSSHAIR_HIGHLIGHT_Z_INDEX,
399
+ _addShapes(e, r, t, s) {
400
+ const { startRow: i, endRow: o, startColumn: a, endColumn: h } = e, _ = V(i, a, t, s), v = V(o, h, t, s), { startX: p, startY: m } = _, { endX: u, endY: K } = v, z = u - p, J = K - m, Q = {
401
+ left: p,
402
+ top: m,
403
+ color: new oe(this._color).toRgb(),
404
+ width: z,
405
+ height: J,
406
+ zIndex: Je,
326
407
  evented: !1
327
- }, currentShapes = new SheetCrossHairHighlightShape(`crosshair-${index}`, shapeProps);
328
- this._shapes.push(currentShapes), scene.addObject(currentShapes);
408
+ }, x = new et(`crosshair-${r}`, Q);
409
+ this._shapes.push(x), t.addObject(x);
329
410
  }
330
- render(ranges) {
331
- const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
332
- if (!skeleton)
411
+ render(e) {
412
+ const r = this._sheetSkeletonManagerService.getCurrentSkeleton();
413
+ if (!r)
333
414
  return;
334
- const { scene } = this._context;
415
+ const { scene: t } = this._context;
335
416
  this._clear();
336
- for (let i = 0; i < ranges.length; i++) {
337
- const range = ranges[i];
338
- this._addShapes(range, i, scene, skeleton);
417
+ for (let s = 0; s < e.length; s++) {
418
+ const i = e[s];
419
+ this._addShapes(i, s, t, r);
339
420
  }
340
- scene.makeDirty(!0);
421
+ t.makeDirty(!0);
341
422
  }
342
423
  async dispose() {
343
424
  super.dispose();
344
425
  }
345
- }, __name(_a2, "SheetCrosshairHighlightRenderController"), _a2);
346
- SheetCrosshairHighlightRenderController = __decorateClass$1([
347
- __decorateParam$1(1, Inject(SheetSkeletonManagerService)),
348
- __decorateParam$1(2, Inject(SheetsSelectionsService)),
349
- __decorateParam$1(3, Inject(SheetsCrosshairHighlightService)),
350
- __decorateParam$1(4, Inject(IContextService)),
351
- __decorateParam$1(5, IRefSelectionsService)
352
- ], SheetCrosshairHighlightRenderController);
353
- const PLUGIN_CONFIG_KEY = "sheets-crosshair-highlight.config", defaultPluginConfig = {};
354
- var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
355
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
356
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
357
- return kind && result && __defProp2(target, key, result), result;
358
- }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), _a3;
359
- let UniverSheetsCrosshairHighlightPlugin = (_a3 = class extends Plugin {
360
- constructor(_config = defaultPluginConfig, _injector, _renderManagerService, _configService) {
361
- super(), this._config = _config, this._injector = _injector, this._renderManagerService = _renderManagerService, this._configService = _configService;
362
- const { ...rest } = this._config;
363
- this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
426
+ };
427
+ R = nt([
428
+ S(1, d(Ie)),
429
+ S(2, d(ye)),
430
+ S(3, d(g)),
431
+ S(4, d(ie)),
432
+ S(5, we)
433
+ ], R);
434
+ const st = "sheets-crosshair-highlight.config", it = {};
435
+ var ot = Object.defineProperty, at = Object.getOwnPropertyDescriptor, ct = (n, e, r, t) => {
436
+ for (var s = t > 1 ? void 0 : t ? at(e, r) : e, i = n.length - 1, o; i >= 0; i--)
437
+ (o = n[i]) && (s = (t ? o(e, r, s) : o(s)) || s);
438
+ return t && s && ot(e, r, s), s;
439
+ }, E = (n, e) => (r, t) => e(r, t, n), C;
440
+ let A = (C = class extends ae {
441
+ constructor(n = it, e, r, t) {
442
+ super(), this._config = n, this._injector = e, this._renderManagerService = r, this._configService = t;
443
+ const { ...s } = this._config;
444
+ this._configService.setConfig(st, s);
364
445
  }
365
446
  onStarting() {
366
447
  [
367
- [SheetsCrosshairHighlightService],
368
- [SheetsCrosshairHighlightController]
369
- ].forEach((d) => this._injector.add(d));
448
+ [g],
449
+ [b]
450
+ ].forEach((n) => this._injector.add(n));
370
451
  }
371
452
  onReady() {
372
453
  [
373
- [SheetCrosshairHighlightRenderController]
374
- ].forEach((d) => this._injector.add(d)), this._injector.get(SheetsCrosshairHighlightController), this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, [SheetCrosshairHighlightRenderController]);
375
- }
376
- }, __name(_a3, "UniverSheetsCrosshairHighlightPlugin"), __publicField(_a3, "pluginName", "SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"), __publicField(_a3, "type", UniverInstanceType.UNIVER_SHEET), _a3);
377
- UniverSheetsCrosshairHighlightPlugin = __decorateClass([
378
- __decorateParam(1, Inject(Injector)),
379
- __decorateParam(2, IRenderManagerService),
380
- __decorateParam(3, IConfigService)
381
- ], UniverSheetsCrosshairHighlightPlugin);
454
+ [R]
455
+ ].forEach((n) => this._injector.add(n)), this._injector.get(b), this._renderManagerService.registerRenderModule(w.UNIVER_SHEET, [R]);
456
+ }
457
+ }, c(C, "pluginName", "SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"), c(C, "type", w.UNIVER_SHEET), C);
458
+ A = ct([
459
+ E(1, d(ce)),
460
+ E(2, ue),
461
+ E(3, le)
462
+ ], A);
382
463
  export {
383
- CROSSHAIR_HIGHLIGHT_COLORS,
384
- DisableCrosshairHighlightOperation,
385
- EnableCrosshairHighlightOperation,
386
- SetCrosshairHighlightColorOperation,
387
- ToggleCrosshairHighlightOperation,
388
- UniverSheetsCrosshairHighlightPlugin
464
+ B as CROSSHAIR_HIGHLIGHT_COLORS,
465
+ je as DisableCrosshairHighlightOperation,
466
+ Ne as EnableCrosshairHighlightOperation,
467
+ W as SetCrosshairHighlightColorOperation,
468
+ $ as ToggleCrosshairHighlightOperation,
469
+ A as UniverSheetsCrosshairHighlightPlugin
389
470
  };
@@ -1,4 +1,4 @@
1
- const locale = {
1
+ const o = {
2
2
  crosshair: {
3
3
  button: {
4
4
  tooltip: "Crosshair Highlight"
@@ -6,5 +6,5 @@ const locale = {
6
6
  }
7
7
  };
8
8
  export {
9
- locale as default
9
+ o as default
10
10
  };
@@ -1,4 +1,4 @@
1
- const locale = {
1
+ const o = {
2
2
  crosshair: {
3
3
  button: {
4
4
  tooltip: "برجسته کردن خط نشانه"
@@ -6,5 +6,5 @@ const locale = {
6
6
  }
7
7
  };
8
8
  export {
9
- locale as default
9
+ o as default
10
10
  };
@@ -1,4 +1,4 @@
1
- const locale = {
1
+ const o = {
2
2
  crosshair: {
3
3
  button: {
4
4
  tooltip: "Перекрестный выделение"
@@ -6,5 +6,5 @@ const locale = {
6
6
  }
7
7
  };
8
8
  export {
9
- locale as default
9
+ o as default
10
10
  };
@@ -1,4 +1,4 @@
1
- const locale = {
1
+ const o = {
2
2
  crosshair: {
3
3
  button: {
4
4
  tooltip: "Đánh dấu chéo"
@@ -6,5 +6,5 @@ const locale = {
6
6
  }
7
7
  };
8
8
  export {
9
- locale as default
9
+ o as default
10
10
  };
@@ -1,4 +1,4 @@
1
- const locale = {
1
+ const o = {
2
2
  crosshair: {
3
3
  button: {
4
4
  tooltip: "十字高亮"
@@ -6,5 +6,5 @@ const locale = {
6
6
  }
7
7
  };
8
8
  export {
9
- locale as default
9
+ o as default
10
10
  };
@@ -1,4 +1,4 @@
1
- const locale = {
1
+ const o = {
2
2
  crosshair: {
3
3
  button: {
4
4
  tooltip: "十字高亮"
@@ -6,5 +6,5 @@ const locale = {
6
6
  }
7
7
  };
8
8
  export {
9
- locale as default
9
+ o as default
10
10
  };
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){typeof exports=="object"&&typeof module<"u"?t(require("@univerjs/core"),require("rxjs")):typeof define=="function"&&define.amd?define(["@univerjs/core","rxjs"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.UniverCore,e.rxjs))})(this,function(e,t){"use strict";var b=Object.defineProperty;var c=(e,t,n)=>t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var a=(e,t,n)=>c(e,typeof t!="symbol"?t+"":t,n);const n=["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 o extends e.Disposable{constructor(){super(...arguments);a(this,"_enabled$",new t.BehaviorSubject(!1));a(this,"enabled$",this._enabled$.asObservable());a(this,"_color$",new t.BehaviorSubject(n[0]));a(this,"color$",this._color$.asObservable())}get enabled(){return this._enabled$.getValue()}get color(){return this._color$.getValue()}dispose(){this._enabled$.complete()}setEnabled(s){this._enabled$.next(s)}setColor(s){this._color$.next(s)}}e.CommandType.OPERATION;const l={id:"sheet.operation.set-crosshair-highlight-color",type:e.CommandType.OPERATION,handler(i,{value:r}){const s=i.get(o);return s.enabled||s.setEnabled(!0),s.setColor(r),!0}},h={id:"sheet.operation.enable-crosshair-highlight",type:e.CommandType.OPERATION,handler(i){const r=i.get(o);return r.enabled?!1:(r.setEnabled(!0),!0)}},d={id:"sheet.operation.disable-crosshair-highlight",type:e.CommandType.OPERATION,handler(i){const r=i.get(o);return r.enabled?(r.setEnabled(!1),!0):!1}};class g extends e.FUniver{setCrosshairHighlightEnabled(r){r?this._commandService.executeCommand(h.id):this._commandService.executeCommand(d.id)}setCrosshairHighlightColor(r){this._commandService.executeCommand(l.id,{value:r})}}e.FUniver.extend(g)});
1
+ (function(e,i){typeof exports=="object"&&typeof module<"u"?i(require("@univerjs/core"),require("@univerjs/sheets-crosshair-highlight")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-crosshair-highlight"],i):(e=typeof globalThis<"u"?globalThis:e||self,i(e.UniverCore,e.UniverSheetsCrosshairHighlight))})(this,function(e,i){"use strict";class n extends e.FUniver{setCrosshairHighlightEnabled(r){r?this._commandService.executeCommand(i.EnableCrosshairHighlightOperation.id):this._commandService.executeCommand(i.DisableCrosshairHighlightOperation.id)}setCrosshairHighlightColor(r){this._commandService.executeCommand(i.SetCrosshairHighlightColorOperation.id,{value:r})}}e.FUniver.extend(n)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-crosshair-highlight",
3
- "version": "0.4.2-nightly.202411071606",
3
+ "version": "0.4.2-nightly.202411091134",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -21,21 +21,25 @@
21
21
  "exports": {
22
22
  ".": {
23
23
  "import": "./lib/es/index.js",
24
+ "require": "./lib/cjs/index.js",
24
25
  "types": "./lib/types/index.d.ts"
25
26
  },
26
27
  "./*": {
27
28
  "import": "./lib/es/*",
29
+ "require": "./lib/cjs/*",
28
30
  "types": "./lib/types/index.d.ts"
29
31
  },
30
- "./lib/*": "./lib/*",
31
32
  "./facade": {
32
33
  "import": "./lib/es/facade.js",
34
+ "require": "./lib/cjs/facade.js",
33
35
  "types": "./lib/types/facade/index.d.ts"
34
36
  },
35
37
  "./locale/*": {
36
- "import": "./lib/locale/*.js",
38
+ "import": "./lib/es/locale/*.js",
39
+ "require": "./lib/cjs/locale/*.js",
37
40
  "types": "./lib/types/locale/*.d.ts"
38
- }
41
+ },
42
+ "./lib/*": "./lib/*"
39
43
  },
40
44
  "main": "./lib/es/index.js",
41
45
  "types": "./lib/types/index.d.ts",
@@ -53,13 +57,13 @@
53
57
  "rxjs": ">=7.0.0"
54
58
  },
55
59
  "dependencies": {
56
- "@univerjs/icons": "^0.2.3",
60
+ "@univerjs/icons": "^0.2.5",
57
61
  "clsx": "^2.1.1",
58
- "@univerjs/core": "0.4.2-nightly.202411071606",
59
- "@univerjs/sheets": "0.4.2-nightly.202411071606",
60
- "@univerjs/engine-render": "0.4.2-nightly.202411071606",
61
- "@univerjs/ui": "0.4.2-nightly.202411071606",
62
- "@univerjs/sheets-ui": "0.4.2-nightly.202411071606"
62
+ "@univerjs/core": "0.4.2-nightly.202411091134",
63
+ "@univerjs/engine-render": "0.4.2-nightly.202411091134",
64
+ "@univerjs/sheets": "0.4.2-nightly.202411091134",
65
+ "@univerjs/ui": "0.4.2-nightly.202411091134",
66
+ "@univerjs/sheets-ui": "0.4.2-nightly.202411091134"
63
67
  },
64
68
  "devDependencies": {
65
69
  "less": "^4.2.0",
@@ -70,31 +74,35 @@
70
74
  "vitest": "^2.1.4",
71
75
  "@univerjs-infra/shared": "0.4.2"
72
76
  },
73
- "univerSpace": {
77
+ "space": {
74
78
  ".": {
75
79
  "import": "./lib/es/index.js",
80
+ "require": "./lib/cjs/index.js",
76
81
  "types": "./lib/types/index.d.ts"
77
82
  },
78
83
  "./*": {
79
84
  "import": "./lib/es/*",
85
+ "require": "./lib/cjs/*",
80
86
  "types": "./lib/types/index.d.ts"
81
87
  },
82
- "./lib/*": "./lib/*",
83
88
  "./facade": {
84
89
  "import": "./lib/es/facade.js",
90
+ "require": "./lib/cjs/facade.js",
85
91
  "types": "./lib/types/facade/index.d.ts"
86
92
  },
87
93
  "./locale/*": {
88
- "import": "./lib/locale/*.js",
94
+ "import": "./lib/es/locale/*.js",
95
+ "require": "./lib/cjs/locale/*.js",
89
96
  "types": "./lib/types/locale/*.d.ts"
90
- }
97
+ },
98
+ "./lib/*": "./lib/*"
91
99
  },
92
100
  "scripts": {
93
101
  "test": "vitest run",
94
102
  "test:watch": "vitest",
95
103
  "coverage": "vitest run --coverage",
96
104
  "lint:types": "tsc --noEmit",
97
- "build": "tsc && vite build"
105
+ "build": "tsx build.ts"
98
106
  },
99
107
  "module": "./lib/es/index.js"
100
108
  }
@@ -1,86 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { Disposable, CommandType } from "@univerjs/core";
6
- import { BehaviorSubject } from "rxjs";
7
- const CROSSHAIR_HIGHLIGHT_COLORS = [
8
- "rgba(158, 109, 227, 0.3)",
9
- "rgba(254, 75, 75, 0.3)",
10
- "rgba(255, 140, 81, 0.3)",
11
- "rgba(164, 220, 22, 0.3)",
12
- "rgba(45, 174, 255, 0.3)",
13
- "rgba(58, 96, 247, 0.3)",
14
- "rgba(242, 72, 166, 0.3)",
15
- "rgba(153, 153, 153, 0.3)",
16
- "rgba(158, 109, 227, 0.15)",
17
- "rgba(254, 75, 75, 0.15)",
18
- "rgba(255, 140, 81, 0.15)",
19
- "rgba(164, 220, 22, 0.15)",
20
- "rgba(45, 174, 255, 0.15)",
21
- "rgba(58, 96, 247, 0.15)",
22
- "rgba(242, 72, 166, 0.15)",
23
- "rgba(153, 153, 153, 0.15)"
24
- ], _SheetsCrosshairHighlightService = class _SheetsCrosshairHighlightService extends Disposable {
25
- constructor() {
26
- super(...arguments);
27
- __publicField(this, "_enabled$", new BehaviorSubject(!1));
28
- __publicField(this, "enabled$", this._enabled$.asObservable());
29
- __publicField(this, "_color$", new BehaviorSubject(CROSSHAIR_HIGHLIGHT_COLORS[0]));
30
- __publicField(this, "color$", this._color$.asObservable());
31
- }
32
- get enabled() {
33
- return this._enabled$.getValue();
34
- }
35
- get color() {
36
- return this._color$.getValue();
37
- }
38
- dispose() {
39
- this._enabled$.complete();
40
- }
41
- setEnabled(value) {
42
- this._enabled$.next(value);
43
- }
44
- setColor(value) {
45
- this._color$.next(value);
46
- }
47
- };
48
- __name(_SheetsCrosshairHighlightService, "SheetsCrosshairHighlightService");
49
- let SheetsCrosshairHighlightService = _SheetsCrosshairHighlightService;
50
- const ToggleCrosshairHighlightOperation = {
51
- id: "sheet.operation.toggle-crosshair-highlight",
52
- type: CommandType.OPERATION,
53
- handler(accessor) {
54
- const service = accessor.get(SheetsCrosshairHighlightService), turnedOn = service.enabled;
55
- return service.setEnabled(!turnedOn), !0;
56
- }
57
- }, SetCrosshairHighlightColorOperation = {
58
- id: "sheet.operation.set-crosshair-highlight-color",
59
- type: CommandType.OPERATION,
60
- handler(accessor, { value }) {
61
- const service = accessor.get(SheetsCrosshairHighlightService);
62
- return service.enabled || service.setEnabled(!0), service.setColor(value), !0;
63
- }
64
- }, EnableCrosshairHighlightOperation = {
65
- id: "sheet.operation.enable-crosshair-highlight",
66
- type: CommandType.OPERATION,
67
- handler(accessor) {
68
- const service = accessor.get(SheetsCrosshairHighlightService);
69
- return service.enabled ? !1 : (service.setEnabled(!0), !0);
70
- }
71
- }, DisableCrosshairHighlightOperation = {
72
- id: "sheet.operation.disable-crosshair-highlight",
73
- type: CommandType.OPERATION,
74
- handler(accessor) {
75
- const service = accessor.get(SheetsCrosshairHighlightService);
76
- return service.enabled ? (service.setEnabled(!1), !0) : !1;
77
- }
78
- };
79
- export {
80
- CROSSHAIR_HIGHLIGHT_COLORS as C,
81
- DisableCrosshairHighlightOperation as D,
82
- EnableCrosshairHighlightOperation as E,
83
- SheetsCrosshairHighlightService as S,
84
- ToggleCrosshairHighlightOperation as T,
85
- SetCrosshairHighlightColorOperation as a
86
- };