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