@univerjs/sheets-crosshair-highlight 0.5.5 → 0.6.0-experimental.20250125-1d060b9

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 CHANGED
@@ -1,9 +1 @@
1
- "use strict";var z=Object.defineProperty;var Q=(n,e,t)=>e in n?z(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var g=(n,e,t)=>Q(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),P=require("@univerjs/engine-render"),m=require("@univerjs/ui"),_=require("rxjs"),C=require("react"),$=require("@univerjs/sheets"),M=require("@univerjs/sheets-ui"),ee="sheets-crosshair-highlight.config",A={};var u=function(){return u=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},u.apply(this,arguments)},te=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},D=C.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,s=n.extend,o=te(n,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),l=C.useRef("_".concat(ie()));return q(t,"".concat(r),{defIds:t.defIds,idSuffix:l.current},u({ref:e,className:c},o),s)});function q(n,e,t,r,i){return C.createElement(n.tag,u(u({key:e},re(n,t,i)),r),(ne(n,t).children||[]).map(function(s,o){return q(s,"".concat(e,"-").concat(n.tag,"-").concat(o),t,void 0,i)}))}function re(n,e,t){var r=u({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(s){var o=s[0],c=s[1];typeof c=="string"&&(r[o]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function ne(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?u(u({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?u(u({},i),{attrs:u(u({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function ie(){return Math.random().toString(36).substring(2,8)}D.displayName="UniverIcon";var se={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#E5E5E5",d:"M1.6499 3.65002C1.6499 2.54545 2.54533 1.65002 3.6499 1.65002H12.3499C13.4545 1.65002 14.3499 2.54545 14.3499 3.65002V12.35C14.3499 13.4546 13.4545 14.35 12.3499 14.35H3.6499C2.54533 14.35 1.6499 13.4546 1.6499 12.35V3.65002Z"}},{tag:"path",attrs:{fill:"#fff",d:"M9.9998 1.65002H5.9998V6H1.6499V10H5.9998V14.35H9.9998V10H14.3499V6H9.9998V1.65002Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M3.6498 1.05005C2.21386 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V3.65005C14.9498 2.21411 13.7857 1.05005 12.3498 1.05005H3.6498ZM5.4002 2.25005H3.6498C2.87661 2.25005 2.2498 2.87685 2.2498 3.65005V5.40002H5.4002V2.25005ZM2.2498 10.6V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H5.4002V10.6H2.2498ZM6.60019 13.75H9.4002V9.40002H13.7498V6.60002H9.4002V2.25005H6.60019V6.60002H2.25029V9.40002H6.60019V13.75ZM10.6002 2.25005V5.40002H13.7498V3.65005C13.7498 2.87685 13.123 2.25005 12.3498 2.25005H10.6002ZM13.7498 10.6H10.6002V13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.6Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Y=C.forwardRef(function(n,e){return C.createElement(D,Object.assign({},n,{id:"cross-highlighting-single",ref:e,icon:se}))});Y.displayName="CrossHighlightingSingle";const j=["rgba(158, 109, 227, 0.3)","rgba(254, 75, 75, 0.3)","rgba(255, 140, 81, 0.3)","rgba(164, 220, 22, 0.3)","rgba(45, 174, 255, 0.3)","rgba(58, 96, 247, 0.3)","rgba(242, 72, 166, 0.3)","rgba(153, 153, 153, 0.3)","rgba(158, 109, 227, 0.15)","rgba(254, 75, 75, 0.15)","rgba(255, 140, 81, 0.15)","rgba(164, 220, 22, 0.15)","rgba(45, 174, 255, 0.15)","rgba(58, 96, 247, 0.15)","rgba(242, 72, 166, 0.15)","rgba(153, 153, 153, 0.15)"];class S extends a.Disposable{constructor(){super(...arguments);g(this,"_enabled$",new _.BehaviorSubject(!1));g(this,"enabled$",this._enabled$.asObservable());g(this,"_color$",new _.BehaviorSubject(j[0]));g(this,"color$",this._color$.asObservable())}get enabled(){return this._enabled$.getValue()}get color(){return this._color$.getValue()}dispose(){this._enabled$.complete()}setEnabled(t){this._enabled$.next(t)}setColor(t){this._color$.next(t)}}const E={id:"sheet.operation.toggle-crosshair-highlight",type:a.CommandType.OPERATION,handler(n){const e=n.get(S),t=e.enabled;return e.setEnabled(!t),!0}},N={id:"sheet.operation.set-crosshair-highlight-color",type:a.CommandType.OPERATION,handler(n,{value:e}){const t=n.get(S);return t.enabled||t.setEnabled(!0),t.setColor(e),!0}},k={id:"sheet.operation.enable-crosshair-highlight",type:a.CommandType.OPERATION,handler(n){const e=n.get(S);return e.enabled?!1:(e.setEnabled(!0),!0)}},B={id:"sheet.operation.disable-crosshair-highlight",type:a.CommandType.OPERATION,handler(n){const e=n.get(S);return e.enabled?(e.setEnabled(!1),!0):!1}};var y={exports:{}},R={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var L;function oe(){if(L)return R;L=1;var n=C,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(c,l,p){var h,f={},v=null,d=null;p!==void 0&&(v=""+p),l.key!==void 0&&(v=""+l.key),l.ref!==void 0&&(d=l.ref);for(h in l)r.call(l,h)&&!s.hasOwnProperty(h)&&(f[h]=l[h]);if(c&&c.defaultProps)for(h in l=c.defaultProps,l)f[h]===void 0&&(f[h]=l[h]);return{$$typeof:e,type:c,key:v,ref:d,props:f,_owner:i.current}}return R.Fragment=t,R.jsx=o,R.jsxs=o,R}var G;function ae(){return G||(G=1,y.exports=oe()),y.exports}var U=ae();function Z(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=Z(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function ce(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=Z(n))&&(r&&(r+=" "),r+=e);return r}const le="univer-crosshair-highlight-overlay",he="univer-crosshair-highlight-item",ge="univer-crosshair-highlight-item-selected",T={crosshairHighlightOverlay:le,crosshairHighlightItem:he,crosshairHighlightItemSelected:ge};function ue(n){const{onChange:e}=n,t=a.useDependency(S),r=a.useObservable(t.color$),i=C.useCallback(s=>{e==null||e(s)},[e]);return U.jsx("div",{className:T.crosshairHighlightOverlay,children:j.map(s=>U.jsx("div",{className:ce(T.crosshairHighlightItem,{[T.crosshairHighlightItemSelected]:s===r}),style:{backgroundColor:s},onClick:()=>i(s)},s))})}const F="CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";function de(n){const e=n.get(S);return{id:E.id,tooltip:"crosshair.button.tooltip",type:m.MenuItemType.BUTTON_SELECTOR,icon:"CrossHighlightingSingle",selections:[{label:{name:F,hoverable:!1}}],selectionsCommandId:N.id,activated$:e.enabled$,hidden$:m.getMenuHiddenObservable(n,a.UniverInstanceType.UNIVER_SHEET)}}const fe={[m.ContextMenuPosition.FOOTER_MENU]:{[m.ContextMenuGroup.OTHERS]:{[E.id]:{order:0,menuItemFactory:de}}}};var _e=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,pe=(n,e,t,r)=>{for(var i=r>1?void 0:r?Se(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&_e(e,t,i),i},w=(n,e)=>(t,r)=>e(t,r,n);let O=class extends a.Disposable{constructor(n,e,t){super(),this._componentMgr=n,this._menuManagerService=e,this._cmdSrv=t,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[E,N,k,B].forEach(n=>this._cmdSrv.registerCommand(n))}_initMenus(){this._menuManagerService.mergeMenu(fe)}_initComponents(){this._componentMgr.register(F,ue),this._componentMgr.register("CrossHighlightingSingle",Y)}};O=pe([w(0,a.Inject(m.ComponentManager)),w(1,m.IMenuManagerService),w(2,a.ICommandService)],O);const ve=1;class Ce{constructor(){g(this,"_selectedRanges",[]);g(this,"_ranges",[])}addRange(e){if(e.rangeType===a.RANGE_TYPE.COLUMN||e.rangeType===a.RANGE_TYPE.ROW||e.rangeType===a.RANGE_TYPE.ALL)return;const t=this._getIntersects(e),r=this._getSplitRanges(e,t);r.length>0&&this._ranges.push(...r)}setSelectedRanges(e){this._selectedRanges=e}_getSplitRanges(e,t){let r=[e];for(const i of t.concat(this._selectedRanges)){const s=[];for(const o of r){const c=a.Rectangle.subtract(o,i);c&&c.length>0&&s.push(...c)}r=s}return r.filter(i=>i.startRow<=i.endRow&&i.startColumn<=i.endColumn)}_getIntersects(e){const t=[];for(const r of this._ranges){const i=a.Rectangle.getIntersects(r,e);i&&t.push(i)}return t}getRanges(){return this._ranges}reset(){this._ranges=[],this._selectedRanges=[]}}class me extends P.Shape{constructor(t,r){super(t,r);g(this,"_color");r&&this.setShapeProps(r)}setShapeProps(t){typeof t.color<"u"&&(this._color=t.color),this.transformByState({width:t.width,height:t.height})}_draw(t){const r=`rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${this._color.a})`;P.Rect.drawWith(t,{width:this.width,height:this.height,fill:r,stroke:void 0,strokeWidth:0,evented:!1})}}var Re=Object.defineProperty,be=Object.getOwnPropertyDescriptor,He=(n,e,t,r)=>{for(var i=r>1?void 0:r?be(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Re(e,t,i),i},b=(n,e)=>(t,r)=>e(t,r,n);let I=class extends a.Disposable{constructor(e,t,r,i,s,o){super();g(this,"_shapes",[]);g(this,"_rangeCollection",new Ce);g(this,"_color","rgba(255,0,0,0.5)");this._context=e,this._sheetSkeletonManagerService=t,this._sheetsSelectionsService=r,this._sheetsCrosshairHighlightService=i,this._contextService=s,this._refSelectionsService=o,this._initRenderListener()}_transformSelection(e,t){if(!e)return;const r=t.getRowCount(),i=t.getColumnCount(),s=[];for(const o of e){const{startRow:c,endRow:l,startColumn:p,endColumn:h}=o.range;l-c+1===r||h-p+1===i||s.push(o.range)}this._rangeCollection.setSelectedRanges(s);for(const o of s)this.addSelection(o,t)}_initRenderListener(){const e=this._context.unit;this.disposeWithMe(_.combineLatest([this._contextService.subscribeContextValue$($.REF_SELECTIONS_ENABLED).pipe(_.startWith(!1)),this._sheetSkeletonManagerService.currentSkeleton$,this._sheetsCrosshairHighlightService.enabled$,this._sheetsCrosshairHighlightService.color$.pipe(_.tap(t=>this._color=t)),_.merge(this._sheetsSelectionsService.selectionMoveStart$,this._sheetsSelectionsService.selectionMoving$,this._sheetsSelectionsService.selectionMoveEnd$,this._sheetsSelectionsService.selectionSet$,e.activeSheet$.pipe(_.map(()=>this._sheetsSelectionsService.getCurrentSelections()))),_.merge(this._refSelectionsService.selectionMoveStart$,this._refSelectionsService.selectionMoving$,this._refSelectionsService.selectionMoveEnd$,this._sheetsSelectionsService.selectionSet$,e.activeSheet$.pipe(_.map(()=>this._refSelectionsService.getCurrentSelections())))]).subscribe(([t,r,i,s,o,c])=>{if(this._clear(),!i)return;const l=t?c:o;this._rangeCollection.reset(),this._transformSelection(l,e.getActiveSheet()),this.render(this._rangeCollection.getRanges())}))}addSelection(e,t){if(e.rangeType===a.RANGE_TYPE.COLUMN||e.rangeType===a.RANGE_TYPE.ROW||e.rangeType===a.RANGE_TYPE.ALL)return;const r=t.getRowCount(),i=t.getColumnCount(),{startRow:s,endRow:o,startColumn:c,endColumn:l}=e,p={startRow:s,endRow:o,startColumn:0,endColumn:c-1},h={startRow:s,endRow:o,startColumn:l+1,endColumn:i},f={startRow:0,endRow:s-1,startColumn:c,endColumn:l},v={startRow:o+1,endRow:r,startColumn:c,endColumn:l};for(const d of[p,h,f,v])d.startRow<=d.endRow&&d.startColumn<=d.endColumn&&this._rangeCollection.addRange(d)}_clear(){this._shapes.forEach(e=>{e.dispose()}),this._shapes=[]}_addShapes(e,t,r,i){const{startRow:s,endRow:o,startColumn:c,endColumn:l}=e,p=M.getCoordByCell(s,c,r,i),h=M.getCoordByCell(o,l,r,i),{startX:f,startY:v}=p,{endX:d,endY:W}=h,J=d-f,X=W-v,K={left:f,top:v,color:new a.ColorKit(this._color).toRgb(),width:J,height:X,zIndex:ve,evented:!1},V=new me(`crosshair-${t}`,K);this._shapes.push(V),r.addObject(V)}render(e){const t=this._sheetSkeletonManagerService.getCurrentSkeleton();if(!t)return;const{scene:r}=this._context;this._clear();for(let i=0;i<e.length;i++){const s=e[i];this._addShapes(s,i,r,t)}r.makeDirty(!0)}async dispose(){super.dispose()}};I=He([b(1,a.Inject(M.SheetSkeletonManagerService)),b(2,a.Inject($.SheetsSelectionsService)),b(3,a.Inject(S)),b(4,a.Inject(a.IContextService)),b(5,$.IRefSelectionsService)],I);var Oe=Object.defineProperty,Ie=Object.getOwnPropertyDescriptor,Ee=(n,e,t,r)=>{for(var i=r>1?void 0:r?Ie(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Oe(e,t,i),i},x=(n,e)=>(t,r)=>e(t,r,n),H;exports.UniverSheetsCrosshairHighlightPlugin=(H=class extends a.Plugin{constructor(e=A,t,r,i){super(),this._config=e,this._injector=t,this._renderManagerService=r,this._configService=i;const{...s}=a.merge({},A,this._config);this._configService.setConfig(ee,s)}onStarting(){[[S],[O]].forEach(e=>this._injector.add(e))}onReady(){[[I]].forEach(e=>this._injector.add(e)),this._injector.get(O),this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SHEET,[I])}},g(H,"pluginName","SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"),g(H,"type",a.UniverInstanceType.UNIVER_SHEET),H);exports.UniverSheetsCrosshairHighlightPlugin=Ee([x(1,a.Inject(a.Injector)),x(2,P.IRenderManagerService),x(3,a.IConfigService)],exports.UniverSheetsCrosshairHighlightPlugin);exports.CROSSHAIR_HIGHLIGHT_COLORS=j;exports.DisableCrosshairHighlightOperation=B;exports.EnableCrosshairHighlightOperation=k;exports.SetCrosshairHighlightColorOperation=N;exports.SheetsCrosshairHighlightService=S;exports.ToggleCrosshairHighlightOperation=E;
1
+ "use strict";var F=Object.defineProperty;var X=(n,e,t)=>e in n?F(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var l=(n,e,t)=>X(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),w=require("@univerjs/engine-render"),_=require("@univerjs/ui"),u=require("rxjs"),N=require("react/jsx-runtime"),S=require("react"),M=require("@univerjs/sheets"),P=require("@univerjs/sheets-ui"),K="sheets-crosshair-highlight.config",V={};var h=function(){return h=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},h.apply(this,arguments)},z=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 s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t},A=S.forwardRef(function(n,e){var t=n.icon,r=n.id,s=n.className,i=n.extend,o=z(n,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(s||"").trim(),g=S.useRef("_".concat(ee()));return L(t,"".concat(r),{defIds:t.defIds,idSuffix:g.current},h({ref:e,className:c},o),i)});function L(n,e,t,r,s){return S.createElement(n.tag,h(h({key:e},J(n,t,s)),r),(Q(n,t).children||[]).map(function(i,o){return L(i,"".concat(e,"-").concat(n.tag,"-").concat(o),t,void 0,s)}))}function J(n,e,t){var r=h({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var s=e.defIds;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){var o=i[0],c=i[1];typeof c=="string"&&(r[o]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Q(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)?h(h({},n),{children:n.children.map(function(s){return typeof s.attrs.id=="string"&&r&&r.indexOf(s.attrs.id)>-1?h(h({},s),{attrs:h(h({},s.attrs),{id:s.attrs.id+e.idSuffix})}):s})}):n}function ee(){return Math.random().toString(36).substring(2,8)}A.displayName="UniverIcon";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"}}]},G=S.forwardRef(function(n,e){return S.createElement(A,Object.assign({},n,{id:"cross-highlighting-single",ref:e,icon:te}))});G.displayName="CrossHighlightingSingle";const $=["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($[0]));l(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:a.CommandType.OPERATION,handler(n){const e=n.get(d),t=e.enabled;return e.setEnabled(!t),!0}},j={id:"sheet.operation.set-crosshair-highlight-color",type:a.CommandType.OPERATION,handler(n,{value:e}){const t=n.get(d);return t.enabled||t.setEnabled(!0),t.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}};function Y(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var s=n.length;for(e=0;e<s;e++)n[e]&&(t=Y(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function re(){for(var n,e,t=0,r="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=Y(n))&&(r&&(r+=" "),r+=e);return r}const ne="univer-crosshair-highlight-overlay",se="univer-crosshair-highlight-item",ie="univer-crosshair-highlight-item-selected",E={crosshairHighlightOverlay:ne,crosshairHighlightItem:se,crosshairHighlightItemSelected:ie};function oe(n){const{onChange:e}=n,t=a.useDependency(d),r=a.useObservable(t.color$),s=S.useCallback(i=>{e==null||e(i)},[e]);return N.jsx("div",{className:E.crosshairHighlightOverlay,children:$.map(i=>N.jsx("div",{className:re(E.crosshairHighlightItem,{[E.crosshairHighlightItemSelected]:i===r}),style:{backgroundColor:i},onClick:()=>s(i)},i))})}const B="CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";function ae(n){const e=n.get(d);return{id:I.id,tooltip:"crosshair.button.tooltip",type:_.MenuItemType.BUTTON_SELECTOR,icon:"CrossHighlightingSingle",selections:[{label:{name:B,hoverable:!1}}],selectionsCommandId:j.id,activated$:e.enabled$,hidden$:_.getMenuHiddenObservable(n,a.UniverInstanceType.UNIVER_SHEET)}}const ce={[_.ContextMenuPosition.FOOTER_MENU]:{[_.ContextMenuGroup.OTHERS]:{[I.id]:{order:0,menuItemFactory:ae}}}};var le=Object.defineProperty,he=Object.getOwnPropertyDescriptor,ge=(n,e,t,r)=>{for(var s=r>1?void 0:r?he(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&le(e,t,s),s},y=(n,e)=>(t,r)=>e(t,r,n);let R=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(){[I,j,U,D].forEach(n=>this._cmdSrv.registerCommand(n))}_initMenus(){this._menuManagerService.mergeMenu(ce)}_initComponents(){this._componentMgr.register(B,oe),this._componentMgr.register("CrossHighlightingSingle",G)}};R=ge([y(0,a.Inject(_.ComponentManager)),y(1,_.IMenuManagerService),y(2,a.ICommandService)],R);const ue=1;class de{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 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 s of t.concat(this._selectedRanges)){const i=[];for(const o of r){const c=a.Rectangle.subtract(o,s);c&&c.length>0&&i.push(...c)}r=i}return r.filter(s=>s.startRow<=s.endRow&&s.startColumn<=s.endColumn)}_getIntersects(e){const t=[];for(const r of this._ranges){const s=a.Rectangle.getIntersects(r,e);s&&t.push(s)}return t}getRanges(){return this._ranges}reset(){this._ranges=[],this._selectedRanges=[]}}class fe extends w.Shape{constructor(t,r){super(t,r);l(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})`;w.Rect.drawWith(t,{width:this.width,height:this.height,fill:r,stroke:void 0,strokeWidth:0,evented:!1})}}var _e=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,ve=(n,e,t,r)=>{for(var s=r>1?void 0:r?Se(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&_e(e,t,s),s},p=(n,e)=>(t,r)=>e(t,r,n);let O=class extends a.Disposable{constructor(e,t,r,s,i,o){super();l(this,"_shapes",[]);l(this,"_rangeCollection",new de);l(this,"_color","rgba(255,0,0,0.5)");this._context=e,this._sheetSkeletonManagerService=t,this._sheetsSelectionsService=r,this._sheetsCrosshairHighlightService=s,this._contextService=i,this._refSelectionsService=o,this._initRenderListener()}_transformSelection(e,t){if(!e)return;const r=t.getRowCount(),s=t.getColumnCount(),i=[];for(const o of e){const{startRow:c,endRow:g,startColumn:v,endColumn:C}=o.range;g-c+1===r||C-v+1===s||i.push(o.range)}this._rangeCollection.setSelectedRanges(i);for(const o of i)this.addSelection(o,t)}_initRenderListener(){const e=this._context.unit;this.disposeWithMe(u.combineLatest([this._contextService.subscribeContextValue$(M.REF_SELECTIONS_ENABLED).pipe(u.startWith(!1)),this._sheetSkeletonManagerService.currentSkeleton$,this._sheetsCrosshairHighlightService.enabled$,this._sheetsCrosshairHighlightService.color$.pipe(u.tap(t=>this._color=t)),u.merge(this._sheetsSelectionsService.selectionMoveStart$,this._sheetsSelectionsService.selectionMoving$,this._sheetsSelectionsService.selectionMoveEnd$,this._sheetsSelectionsService.selectionSet$,e.activeSheet$.pipe(u.map(()=>this._sheetsSelectionsService.getCurrentSelections()))),u.merge(this._refSelectionsService.selectionMoveStart$,this._refSelectionsService.selectionMoving$,this._refSelectionsService.selectionMoveEnd$,this._sheetsSelectionsService.selectionSet$,e.activeSheet$.pipe(u.map(()=>this._refSelectionsService.getCurrentSelections())))]).subscribe(([t,r,s,i,o,c])=>{if(this._clear(),!s)return;const g=t?c:o;this._rangeCollection.reset(),this._transformSelection(g,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(),s=t.getColumnCount(),{startRow:i,endRow:o,startColumn:c,endColumn:g}=e,v={startRow:i,endRow:o,startColumn:0,endColumn:c-1},C={startRow:i,endRow:o,startColumn:g+1,endColumn:s},m={startRow:0,endRow:i-1,startColumn:c,endColumn:g},H={startRow:o+1,endRow:r,startColumn:c,endColumn:g};for(const f of[v,C,m,H])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,s){const{startRow:i,endRow:o,startColumn:c,endColumn:g}=e,v=P.getCoordByCell(i,c,r,s),C=P.getCoordByCell(o,g,r,s),{startX:m,startY:H}=v,{endX:f,endY:Z}=C,q=f-m,W=Z-H,k={left:m,top:H,color:new a.ColorKit(this._color).toRgb(),width:q,height:W,zIndex:ue,evented:!1},x=new fe(`crosshair-${t}`,k);this._shapes.push(x),r.addObject(x)}render(e){const t=this._sheetSkeletonManagerService.getCurrentSkeleton();if(!t)return;const{scene:r}=this._context;this._clear();for(let s=0;s<e.length;s++){const i=e[s];this._addShapes(i,s,r,t)}r.makeDirty(!0)}async dispose(){super.dispose()}};O=ve([p(1,a.Inject(P.SheetSkeletonManagerService)),p(2,a.Inject(M.SheetsSelectionsService)),p(3,a.Inject(d)),p(4,a.Inject(a.IContextService)),p(5,M.IRefSelectionsService)],O);var Ce=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,me=(n,e,t,r)=>{for(var s=r>1?void 0:r?pe(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&Ce(e,t,s),s},T=(n,e)=>(t,r)=>e(t,r,n),b;exports.UniverSheetsCrosshairHighlightPlugin=(b=class extends a.Plugin{constructor(e=V,t,r,s){super(),this._config=e,this._injector=t,this._renderManagerService=r,this._configService=s;const{...i}=a.merge({},V,this._config);this._configService.setConfig(K,i)}onStarting(){[[d],[R]].forEach(e=>this._injector.add(e))}onReady(){[[O]].forEach(e=>this._injector.add(e)),this._injector.get(R),this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SHEET,[O])}},l(b,"pluginName","SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"),l(b,"type",a.UniverInstanceType.UNIVER_SHEET),b);exports.UniverSheetsCrosshairHighlightPlugin=me([T(1,a.Inject(a.Injector)),T(2,w.IRenderManagerService),T(3,a.IConfigService)],exports.UniverSheetsCrosshairHighlightPlugin);exports.CROSSHAIR_HIGHLIGHT_COLORS=$;exports.DisableCrosshairHighlightOperation=D;exports.EnableCrosshairHighlightOperation=U;exports.SetCrosshairHighlightColorOperation=j;exports.SheetsCrosshairHighlightService=d;exports.ToggleCrosshairHighlightOperation=I;
package/lib/es/facade.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import { FUniver as o, ICommandService as a } from "@univerjs/core";
2
2
  import { EnableCrosshairHighlightOperation as h, DisableCrosshairHighlightOperation as r, SetCrosshairHighlightColorOperation as s, SheetsCrosshairHighlightService as n, CROSSHAIR_HIGHLIGHT_COLORS as l } from "@univerjs/sheets-crosshair-highlight";
3
3
  class c extends o {
4
+ /**
5
+ * @ignore
6
+ */
4
7
  _initialize(i) {
5
8
  const g = i.get(a);
6
9
  this.disposeWithMe(g.onCommandExecuted((t) => {
package/lib/es/index.js CHANGED
@@ -1,40 +1,41 @@
1
- var re = Object.defineProperty;
2
- var ne = (n, e, t) => e in n ? re(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var h = (n, e, t) => ne(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { Disposable as $, CommandType as O, useDependency as se, useObservable as ie, UniverInstanceType as x, Inject as p, ICommandService as oe, RANGE_TYPE as v, Rectangle as T, IContextService as ae, ColorKit as ce, Plugin as le, merge as he, Injector as ge, IConfigService as ue } from "@univerjs/core";
5
- import { Shape as de, Rect as fe, IRenderManagerService as _e } from "@univerjs/engine-render";
6
- import { MenuItemType as Se, getMenuHiddenObservable as pe, ContextMenuPosition as ve, ContextMenuGroup as me, ComponentManager as Ce, IMenuManagerService as Re } from "@univerjs/ui";
7
- import { BehaviorSubject as N, combineLatest as be, startWith as He, tap as Oe, merge as j, map as V } from "rxjs";
8
- import Ie, { forwardRef as Z, useRef as ye, createElement as B, useCallback as Ee } from "react";
9
- import { SheetsSelectionsService as we, REF_SELECTIONS_ENABLED as xe, IRefSelectionsService as $e } from "@univerjs/sheets";
10
- import { SheetSkeletonManagerService as Me, getCoordByCell as L } from "@univerjs/sheets-ui";
11
- const Pe = "sheets-crosshair-highlight.config", A = {};
12
- var g = function() {
13
- return g = Object.assign || function(n) {
1
+ var J = Object.defineProperty;
2
+ var Q = (n, e, t) => e in n ? J(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var c = (n, e, t) => Q(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Disposable as w, CommandType as R, useDependency as ee, useObservable as te, UniverInstanceType as y, Inject as u, ICommandService as re, RANGE_TYPE as f, Rectangle as T, IContextService as ne, ColorKit as se, Plugin as ie, merge as oe, Injector as ae, IConfigService as ce } from "@univerjs/core";
5
+ import { Shape as le, Rect as he, IRenderManagerService as ge } from "@univerjs/engine-render";
6
+ import { MenuItemType as de, getMenuHiddenObservable as ue, ContextMenuPosition as fe, ContextMenuGroup as _e, ComponentManager as Se, IMenuManagerService as ve } from "@univerjs/ui";
7
+ import { BehaviorSubject as x, combineLatest as pe, startWith as me, tap as Ce, merge as P, map as V } from "rxjs";
8
+ import { jsx as N } from "react/jsx-runtime";
9
+ import { forwardRef as G, useRef as be, createElement as U, useCallback as He } from "react";
10
+ import { SheetsSelectionsService as Re, REF_SELECTIONS_ENABLED as Oe, IRefSelectionsService as Ie } from "@univerjs/sheets";
11
+ import { SheetSkeletonManagerService as Ee, getCoordByCell as j } from "@univerjs/sheets-ui";
12
+ const ye = "sheets-crosshair-highlight.config", L = {};
13
+ var l = function() {
14
+ return l = Object.assign || function(n) {
14
15
  for (var e, t = 1, r = arguments.length; t < r; t++) {
15
16
  e = arguments[t];
16
17
  for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (n[s] = e[s]);
17
18
  }
18
19
  return n;
19
- }, g.apply(this, arguments);
20
- }, Te = function(n, e) {
20
+ }, l.apply(this, arguments);
21
+ }, we = function(n, e) {
21
22
  var t = {};
22
23
  for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && e.indexOf(r) < 0 && (t[r] = n[r]);
23
24
  if (n != null && typeof Object.getOwnPropertySymbols == "function")
24
25
  for (var s = 0, r = Object.getOwnPropertySymbols(n); s < r.length; s++)
25
26
  e.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(n, r[s]) && (t[r[s]] = n[r[s]]);
26
27
  return t;
27
- }, F = Z(function(n, e) {
28
- var t = n.icon, r = n.id, s = n.className, i = n.extend, o = Te(n, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(r, " ").concat(s || "").trim(), c = ye("_".concat(Ve()));
29
- return W(t, "".concat(r), { defIds: t.defIds, idSuffix: c.current }, g({ ref: e, className: a }, o), i);
28
+ }, D = G(function(n, e) {
29
+ var t = n.icon, r = n.id, s = n.className, i = n.extend, o = we(n, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(r, " ").concat(s || "").trim(), h = be("_".concat(Te()));
30
+ return Z(t, "".concat(r), { defIds: t.defIds, idSuffix: h.current }, l({ ref: e, className: a }, o), i);
30
31
  });
31
- function W(n, e, t, r, s) {
32
- return B(n.tag, g(g({ key: e }, Ne(n, t, s)), r), (je(n, t).children || []).map(function(i, o) {
33
- return W(i, "".concat(e, "-").concat(n.tag, "-").concat(o), t, void 0, s);
32
+ function Z(n, e, t, r, s) {
33
+ return U(n.tag, l(l({ key: e }, Me(n, t, s)), r), ($e(n, t).children || []).map(function(i, o) {
34
+ return Z(i, "".concat(e, "-").concat(n.tag, "-").concat(o), t, void 0, s);
34
35
  }));
35
36
  }
36
- function Ne(n, e, t) {
37
- var r = g({}, n.attrs);
37
+ function Me(n, e, t) {
38
+ var r = l({}, n.attrs);
38
39
  t != null && t.colorChannel1 && r.fill === "colorChannel1" && (r.fill = t.colorChannel1);
39
40
  var s = e.defIds;
40
41
  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) {
@@ -42,25 +43,25 @@ function Ne(n, e, t) {
42
43
  typeof a == "string" && (r[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
43
44
  })), r;
44
45
  }
45
- function je(n, e) {
46
+ function $e(n, e) {
46
47
  var t, r = e.defIds;
47
- 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) {
48
- 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
+ return !r || r.length === 0 ? n : n.tag === "defs" && (!((t = n.children) === null || t === void 0) && t.length) ? l(l({}, n), { children: n.children.map(function(s) {
49
+ return typeof s.attrs.id == "string" && r && r.indexOf(s.attrs.id) > -1 ? l(l({}, s), { attrs: l(l({}, s.attrs), { id: s.attrs.id + e.idSuffix }) }) : s;
49
50
  }) }) : n;
50
51
  }
51
- function Ve() {
52
+ function Te() {
52
53
  return Math.random().toString(36).substring(2, 8);
53
54
  }
54
- F.displayName = "UniverIcon";
55
- var Le = { 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 = Z(function(n, e) {
56
- return B(F, Object.assign({}, n, {
55
+ D.displayName = "UniverIcon";
56
+ var xe = { 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" } }] }, B = G(function(n, e) {
57
+ return U(D, Object.assign({}, n, {
57
58
  id: "cross-highlighting-single",
58
59
  ref: e,
59
- icon: Le
60
+ icon: xe
60
61
  }));
61
62
  });
62
- Y.displayName = "CrossHighlightingSingle";
63
- const q = [
63
+ B.displayName = "CrossHighlightingSingle";
64
+ const W = [
64
65
  "rgba(158, 109, 227, 0.3)",
65
66
  "rgba(254, 75, 75, 0.3)",
66
67
  "rgba(255, 140, 81, 0.3)",
@@ -78,13 +79,13 @@ const q = [
78
79
  "rgba(242, 72, 166, 0.15)",
79
80
  "rgba(153, 153, 153, 0.15)"
80
81
  ];
81
- class S extends $ {
82
+ class g extends w {
82
83
  constructor() {
83
84
  super(...arguments);
84
- h(this, "_enabled$", new N(!1));
85
- h(this, "enabled$", this._enabled$.asObservable());
86
- h(this, "_color$", new N(q[0]));
87
- h(this, "color$", this._color$.asObservable());
85
+ c(this, "_enabled$", new x(!1));
86
+ c(this, "enabled$", this._enabled$.asObservable());
87
+ c(this, "_color$", new x(W[0]));
88
+ c(this, "color$", this._color$.asObservable());
88
89
  }
89
90
  get enabled() {
90
91
  return this._enabled$.getValue();
@@ -104,89 +105,60 @@ class S extends $ {
104
105
  }
105
106
  const M = {
106
107
  id: "sheet.operation.toggle-crosshair-highlight",
107
- type: O.OPERATION,
108
+ type: R.OPERATION,
108
109
  handler(n) {
109
- const e = n.get(S), t = e.enabled;
110
+ const e = n.get(g), t = e.enabled;
110
111
  return e.setEnabled(!t), !0;
111
112
  }
112
- }, J = {
113
+ }, Y = {
113
114
  id: "sheet.operation.set-crosshair-highlight-color",
114
- type: O.OPERATION,
115
+ type: R.OPERATION,
115
116
  handler(n, { value: e }) {
116
- const t = n.get(S);
117
+ const t = n.get(g);
117
118
  return t.enabled || t.setEnabled(!0), t.setColor(e), !0;
118
119
  }
119
- }, Ae = {
120
+ }, Pe = {
120
121
  id: "sheet.operation.enable-crosshair-highlight",
121
- type: O.OPERATION,
122
+ type: R.OPERATION,
122
123
  handler(n) {
123
- const e = n.get(S);
124
+ const e = n.get(g);
124
125
  return e.enabled ? !1 : (e.setEnabled(!0), !0);
125
126
  }
126
- }, Ge = {
127
+ }, Ve = {
127
128
  id: "sheet.operation.disable-crosshair-highlight",
128
- type: O.OPERATION,
129
+ type: R.OPERATION,
129
130
  handler(n) {
130
- const e = n.get(S);
131
+ const e = n.get(g);
131
132
  return e.enabled ? (e.setEnabled(!1), !0) : !1;
132
133
  }
133
134
  };
134
- var I = { exports: {} }, m = {};
135
- /**
136
- * @license React
137
- * react-jsx-runtime.production.min.js
138
- *
139
- * Copyright (c) Facebook, Inc. and its affiliates.
140
- *
141
- * This source code is licensed under the MIT license found in the
142
- * LICENSE file in the root directory of this source tree.
143
- */
144
- var G;
145
- function Ue() {
146
- if (G) return m;
147
- G = 1;
148
- var n = Ie, 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 };
149
- function o(a, c, f) {
150
- var l, d = {}, _ = null, u = null;
151
- f !== void 0 && (_ = "" + f), c.key !== void 0 && (_ = "" + c.key), c.ref !== void 0 && (u = c.ref);
152
- for (l in c) r.call(c, l) && !i.hasOwnProperty(l) && (d[l] = c[l]);
153
- if (a && a.defaultProps) for (l in c = a.defaultProps, c) d[l] === void 0 && (d[l] = c[l]);
154
- return { $$typeof: e, type: a, key: _, ref: u, props: d, _owner: s.current };
155
- }
156
- return m.Fragment = t, m.jsx = o, m.jsxs = o, m;
157
- }
158
- var U;
159
- function De() {
160
- return U || (U = 1, I.exports = Ue()), I.exports;
161
- }
162
- var D = De();
163
- function X(n) {
135
+ function k(n) {
164
136
  var e, t, r = "";
165
137
  if (typeof n == "string" || typeof n == "number") r += n;
166
138
  else if (typeof n == "object") if (Array.isArray(n)) {
167
139
  var s = n.length;
168
- for (e = 0; e < s; e++) n[e] && (t = X(n[e])) && (r && (r += " "), r += t);
140
+ for (e = 0; e < s; e++) n[e] && (t = k(n[e])) && (r && (r += " "), r += t);
169
141
  } else for (t in n) n[t] && (r && (r += " "), r += t);
170
142
  return r;
171
143
  }
172
- function ke() {
173
- for (var n, e, t = 0, r = "", s = arguments.length; t < s; t++) (n = arguments[t]) && (e = X(n)) && (r && (r += " "), r += e);
144
+ function Ne() {
145
+ for (var n, e, t = 0, r = "", s = arguments.length; t < s; t++) (n = arguments[t]) && (e = k(n)) && (r && (r += " "), r += e);
174
146
  return r;
175
147
  }
176
- const Ze = "univer-crosshair-highlight-overlay", Be = "univer-crosshair-highlight-item", Fe = "univer-crosshair-highlight-item-selected", y = {
177
- crosshairHighlightOverlay: Ze,
178
- crosshairHighlightItem: Be,
179
- crosshairHighlightItemSelected: Fe
148
+ const je = "univer-crosshair-highlight-overlay", Le = "univer-crosshair-highlight-item", Ae = "univer-crosshair-highlight-item-selected", O = {
149
+ crosshairHighlightOverlay: je,
150
+ crosshairHighlightItem: Le,
151
+ crosshairHighlightItemSelected: Ae
180
152
  };
181
- function We(n) {
182
- const { onChange: e } = n, t = se(S), r = ie(t.color$), s = Ee((i) => {
153
+ function Ge(n) {
154
+ const { onChange: e } = n, t = ee(g), r = te(t.color$), s = He((i) => {
183
155
  e == null || e(i);
184
156
  }, [e]);
185
- return /* @__PURE__ */ D.jsx("div", { className: y.crosshairHighlightOverlay, children: q.map((i) => /* @__PURE__ */ D.jsx(
157
+ return /* @__PURE__ */ N("div", { className: O.crosshairHighlightOverlay, children: W.map((i) => /* @__PURE__ */ N(
186
158
  "div",
187
159
  {
188
- className: ke(y.crosshairHighlightItem, {
189
- [y.crosshairHighlightItemSelected]: i === r
160
+ className: Ne(O.crosshairHighlightItem, {
161
+ [O.crosshairHighlightItemSelected]: i === r
190
162
  }),
191
163
  style: { backgroundColor: i },
192
164
  onClick: () => s(i)
@@ -194,74 +166,74 @@ function We(n) {
194
166
  i
195
167
  )) });
196
168
  }
197
- const K = "CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";
198
- function Ye(n) {
199
- const e = n.get(S);
169
+ const F = "CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";
170
+ function Ue(n) {
171
+ const e = n.get(g);
200
172
  return {
201
173
  id: M.id,
202
174
  tooltip: "crosshair.button.tooltip",
203
- type: Se.BUTTON_SELECTOR,
175
+ type: de.BUTTON_SELECTOR,
204
176
  icon: "CrossHighlightingSingle",
205
177
  selections: [
206
178
  {
207
179
  label: {
208
- name: K,
180
+ name: F,
209
181
  hoverable: !1
210
182
  }
211
183
  }
212
184
  ],
213
- selectionsCommandId: J.id,
185
+ selectionsCommandId: Y.id,
214
186
  activated$: e.enabled$,
215
- hidden$: pe(n, x.UNIVER_SHEET)
187
+ hidden$: ue(n, y.UNIVER_SHEET)
216
188
  };
217
189
  }
218
- const qe = {
219
- [ve.FOOTER_MENU]: {
220
- [me.OTHERS]: {
190
+ const De = {
191
+ [fe.FOOTER_MENU]: {
192
+ [_e.OTHERS]: {
221
193
  [M.id]: {
222
194
  order: 0,
223
- menuItemFactory: Ye
195
+ menuItemFactory: Ue
224
196
  }
225
197
  }
226
198
  }
227
199
  };
228
- var Je = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, Ke = (n, e, t, r) => {
229
- for (var s = r > 1 ? void 0 : r ? Xe(e, t) : e, i = n.length - 1, o; i >= 0; i--)
200
+ var Ze = Object.defineProperty, Be = Object.getOwnPropertyDescriptor, We = (n, e, t, r) => {
201
+ for (var s = r > 1 ? void 0 : r ? Be(e, t) : e, i = n.length - 1, o; i >= 0; i--)
230
202
  (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
231
- return r && s && Je(e, t, s), s;
232
- }, E = (n, e) => (t, r) => e(t, r, n);
233
- let b = class extends $ {
203
+ return r && s && Ze(e, t, s), s;
204
+ }, I = (n, e) => (t, r) => e(t, r, n);
205
+ let b = class extends w {
234
206
  constructor(n, e, t) {
235
207
  super(), this._componentMgr = n, this._menuManagerService = e, this._cmdSrv = t, this._initCommands(), this._initMenus(), this._initComponents();
236
208
  }
237
209
  _initCommands() {
238
210
  [
239
211
  M,
240
- J,
241
- Ae,
242
- Ge
212
+ Y,
213
+ Pe,
214
+ Ve
243
215
  ].forEach((n) => this._cmdSrv.registerCommand(n));
244
216
  }
245
217
  _initMenus() {
246
- this._menuManagerService.mergeMenu(qe);
218
+ this._menuManagerService.mergeMenu(De);
247
219
  }
248
220
  _initComponents() {
249
- this._componentMgr.register(K, We), this._componentMgr.register("CrossHighlightingSingle", Y);
221
+ this._componentMgr.register(F, Ge), this._componentMgr.register("CrossHighlightingSingle", B);
250
222
  }
251
223
  };
252
- b = Ke([
253
- E(0, p(Ce)),
254
- E(1, Re),
255
- E(2, oe)
224
+ b = We([
225
+ I(0, u(Se)),
226
+ I(1, ve),
227
+ I(2, re)
256
228
  ], b);
257
- const ze = 1;
258
- class Qe {
229
+ const Ye = 1;
230
+ class ke {
259
231
  constructor() {
260
- h(this, "_selectedRanges", []);
261
- h(this, "_ranges", []);
232
+ c(this, "_selectedRanges", []);
233
+ c(this, "_ranges", []);
262
234
  }
263
235
  addRange(e) {
264
- if (e.rangeType === v.COLUMN || e.rangeType === v.ROW || e.rangeType === v.ALL)
236
+ if (e.rangeType === f.COLUMN || e.rangeType === f.ROW || e.rangeType === f.ALL)
265
237
  return;
266
238
  const t = this._getIntersects(e), r = this._getSplitRanges(e, t);
267
239
  r.length > 0 && this._ranges.push(...r);
@@ -296,11 +268,11 @@ class Qe {
296
268
  this._ranges = [], this._selectedRanges = [];
297
269
  }
298
270
  }
299
- class et extends de {
271
+ class Fe extends le {
300
272
  constructor(t, r) {
301
273
  super(t, r);
302
274
  // protected _showHighLight = false;
303
- h(this, "_color");
275
+ c(this, "_color");
304
276
  r && this.setShapeProps(r);
305
277
  }
306
278
  setShapeProps(t) {
@@ -311,7 +283,7 @@ class et extends de {
311
283
  }
312
284
  _draw(t) {
313
285
  const r = `rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${this._color.a})`;
314
- fe.drawWith(t, {
286
+ he.drawWith(t, {
315
287
  width: this.width,
316
288
  height: this.height,
317
289
  fill: r,
@@ -321,17 +293,17 @@ class et extends de {
321
293
  });
322
294
  }
323
295
  }
324
- var tt = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, nt = (n, e, t, r) => {
325
- for (var s = r > 1 ? void 0 : r ? rt(e, t) : e, i = n.length - 1, o; i >= 0; i--)
296
+ var Xe = Object.defineProperty, Ke = Object.getOwnPropertyDescriptor, ze = (n, e, t, r) => {
297
+ for (var s = r > 1 ? void 0 : r ? Ke(e, t) : e, i = n.length - 1, o; i >= 0; i--)
326
298
  (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
327
- return r && s && tt(e, t, s), s;
328
- }, C = (n, e) => (t, r) => e(t, r, n);
329
- let H = class extends $ {
299
+ return r && s && Xe(e, t, s), s;
300
+ }, v = (n, e) => (t, r) => e(t, r, n);
301
+ let H = class extends w {
330
302
  constructor(e, t, r, s, i, o) {
331
303
  super();
332
- h(this, "_shapes", []);
333
- h(this, "_rangeCollection", new Qe());
334
- h(this, "_color", "rgba(255,0,0,0.5)");
304
+ c(this, "_shapes", []);
305
+ c(this, "_rangeCollection", new ke());
306
+ c(this, "_color", "rgba(255,0,0,0.5)");
335
307
  this._context = e, this._sheetSkeletonManagerService = t, this._sheetsSelectionsService = r, this._sheetsCrosshairHighlightService = s, this._contextService = i, this._refSelectionsService = o, this._initRenderListener();
336
308
  }
337
309
  _transformSelection(e, t) {
@@ -339,8 +311,8 @@ let H = class extends $ {
339
311
  return;
340
312
  const r = t.getRowCount(), s = t.getColumnCount(), i = [];
341
313
  for (const o of e) {
342
- const { startRow: a, endRow: c, startColumn: f, endColumn: l } = o.range;
343
- c - a + 1 === r || l - f + 1 === s || i.push(o.range);
314
+ const { startRow: a, endRow: h, startColumn: _, endColumn: S } = o.range;
315
+ h - a + 1 === r || S - _ + 1 === s || i.push(o.range);
344
316
  }
345
317
  this._rangeCollection.setSelectedRanges(i);
346
318
  for (const o of i)
@@ -348,19 +320,19 @@ let H = class extends $ {
348
320
  }
349
321
  _initRenderListener() {
350
322
  const e = this._context.unit;
351
- this.disposeWithMe(be([
352
- this._contextService.subscribeContextValue$(xe).pipe(He(!1)),
323
+ this.disposeWithMe(pe([
324
+ this._contextService.subscribeContextValue$(Oe).pipe(me(!1)),
353
325
  this._sheetSkeletonManagerService.currentSkeleton$,
354
326
  this._sheetsCrosshairHighlightService.enabled$,
355
- this._sheetsCrosshairHighlightService.color$.pipe(Oe((t) => this._color = t)),
356
- j(
327
+ this._sheetsCrosshairHighlightService.color$.pipe(Ce((t) => this._color = t)),
328
+ P(
357
329
  this._sheetsSelectionsService.selectionMoveStart$,
358
330
  this._sheetsSelectionsService.selectionMoving$,
359
331
  this._sheetsSelectionsService.selectionMoveEnd$,
360
332
  this._sheetsSelectionsService.selectionSet$,
361
333
  e.activeSheet$.pipe(V(() => this._sheetsSelectionsService.getCurrentSelections()))
362
334
  ),
363
- j(
335
+ P(
364
336
  this._refSelectionsService.selectionMoveStart$,
365
337
  this._refSelectionsService.selectionMoving$,
366
338
  this._refSelectionsService.selectionMoveEnd$,
@@ -369,36 +341,36 @@ let H = class extends $ {
369
341
  )
370
342
  ]).subscribe(([t, r, s, i, o, a]) => {
371
343
  if (this._clear(), !s) return;
372
- const c = t ? a : o;
373
- this._rangeCollection.reset(), this._transformSelection(c, e.getActiveSheet()), this.render(this._rangeCollection.getRanges());
344
+ const h = t ? a : o;
345
+ this._rangeCollection.reset(), this._transformSelection(h, e.getActiveSheet()), this.render(this._rangeCollection.getRanges());
374
346
  }));
375
347
  }
376
348
  addSelection(e, t) {
377
- if (e.rangeType === v.COLUMN || e.rangeType === v.ROW || e.rangeType === v.ALL)
349
+ if (e.rangeType === f.COLUMN || e.rangeType === f.ROW || e.rangeType === f.ALL)
378
350
  return;
379
- const r = t.getRowCount(), s = t.getColumnCount(), { startRow: i, endRow: o, startColumn: a, endColumn: c } = e, f = {
351
+ const r = t.getRowCount(), s = t.getColumnCount(), { startRow: i, endRow: o, startColumn: a, endColumn: h } = e, _ = {
380
352
  startRow: i,
381
353
  endRow: o,
382
354
  startColumn: 0,
383
355
  endColumn: a - 1
384
- }, l = {
356
+ }, S = {
385
357
  startRow: i,
386
358
  endRow: o,
387
- startColumn: c + 1,
359
+ startColumn: h + 1,
388
360
  endColumn: s
389
- }, d = {
361
+ }, p = {
390
362
  startRow: 0,
391
363
  endRow: i - 1,
392
364
  startColumn: a,
393
- endColumn: c
394
- }, _ = {
365
+ endColumn: h
366
+ }, m = {
395
367
  startRow: o + 1,
396
368
  endRow: r,
397
369
  startColumn: a,
398
- endColumn: c
370
+ endColumn: h
399
371
  };
400
- for (const u of [f, l, d, _])
401
- u.startRow <= u.endRow && u.startColumn <= u.endColumn && this._rangeCollection.addRange(u);
372
+ for (const d of [_, S, p, m])
373
+ d.startRow <= d.endRow && d.startColumn <= d.endColumn && this._rangeCollection.addRange(d);
402
374
  }
403
375
  _clear() {
404
376
  this._shapes.forEach((e) => {
@@ -406,16 +378,16 @@ let H = class extends $ {
406
378
  }), this._shapes = [];
407
379
  }
408
380
  _addShapes(e, t, r, s) {
409
- 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: z } = l, Q = u - d, ee = z - _, te = {
410
- left: d,
411
- top: _,
412
- color: new ce(this._color).toRgb(),
413
- width: Q,
414
- height: ee,
415
- zIndex: ze,
381
+ const { startRow: i, endRow: o, startColumn: a, endColumn: h } = e, _ = j(i, a, r, s), S = j(o, h, r, s), { startX: p, startY: m } = _, { endX: d, endY: X } = S, K = d - p, z = X - m, q = {
382
+ left: p,
383
+ top: m,
384
+ color: new se(this._color).toRgb(),
385
+ width: K,
386
+ height: z,
387
+ zIndex: Ye,
416
388
  evented: !1
417
- }, P = new et(`crosshair-${t}`, te);
418
- this._shapes.push(P), r.addObject(P);
389
+ }, $ = new Fe(`crosshair-${t}`, q);
390
+ this._shapes.push($), r.addObject($);
419
391
  }
420
392
  render(e) {
421
393
  const t = this._sheetSkeletonManagerService.getCurrentSkeleton();
@@ -433,51 +405,51 @@ let H = class extends $ {
433
405
  super.dispose();
434
406
  }
435
407
  };
436
- H = nt([
437
- C(1, p(Me)),
438
- C(2, p(we)),
439
- C(3, p(S)),
440
- C(4, p(ae)),
441
- C(5, $e)
408
+ H = ze([
409
+ v(1, u(Ee)),
410
+ v(2, u(Re)),
411
+ v(3, u(g)),
412
+ v(4, u(ne)),
413
+ v(5, Ie)
442
414
  ], H);
443
- var st = Object.defineProperty, it = Object.getOwnPropertyDescriptor, ot = (n, e, t, r) => {
444
- for (var s = r > 1 ? void 0 : r ? it(e, t) : e, i = n.length - 1, o; i >= 0; i--)
415
+ var qe = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, Qe = (n, e, t, r) => {
416
+ for (var s = r > 1 ? void 0 : r ? Je(e, t) : e, i = n.length - 1, o; i >= 0; i--)
445
417
  (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
446
- return r && s && st(e, t, s), s;
447
- }, w = (n, e) => (t, r) => e(t, r, n), R;
448
- let k = (R = class extends le {
449
- constructor(n = A, e, t, r) {
418
+ return r && s && qe(e, t, s), s;
419
+ }, E = (n, e) => (t, r) => e(t, r, n), C;
420
+ let A = (C = class extends ie {
421
+ constructor(n = L, e, t, r) {
450
422
  super(), this._config = n, this._injector = e, this._renderManagerService = t, this._configService = r;
451
- const { ...s } = he(
423
+ const { ...s } = oe(
452
424
  {},
453
- A,
425
+ L,
454
426
  this._config
455
427
  );
456
- this._configService.setConfig(Pe, s);
428
+ this._configService.setConfig(ye, s);
457
429
  }
458
430
  onStarting() {
459
431
  [
460
- [S],
432
+ [g],
461
433
  [b]
462
434
  ].forEach((n) => this._injector.add(n));
463
435
  }
464
436
  onReady() {
465
437
  [
466
438
  [H]
467
- ].forEach((n) => this._injector.add(n)), this._injector.get(b), this._renderManagerService.registerRenderModule(x.UNIVER_SHEET, [H]);
468
- }
469
- }, h(R, "pluginName", "SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"), h(R, "type", x.UNIVER_SHEET), R);
470
- k = ot([
471
- w(1, p(ge)),
472
- w(2, _e),
473
- w(3, ue)
474
- ], k);
439
+ ].forEach((n) => this._injector.add(n)), this._injector.get(b), this._renderManagerService.registerRenderModule(y.UNIVER_SHEET, [H]);
440
+ }
441
+ }, c(C, "pluginName", "SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"), c(C, "type", y.UNIVER_SHEET), C);
442
+ A = Qe([
443
+ E(1, u(ae)),
444
+ E(2, ge),
445
+ E(3, ce)
446
+ ], A);
475
447
  export {
476
- q as CROSSHAIR_HIGHLIGHT_COLORS,
477
- Ge as DisableCrosshairHighlightOperation,
478
- Ae as EnableCrosshairHighlightOperation,
479
- J as SetCrosshairHighlightColorOperation,
480
- S as SheetsCrosshairHighlightService,
448
+ W as CROSSHAIR_HIGHLIGHT_COLORS,
449
+ Ve as DisableCrosshairHighlightOperation,
450
+ Pe as EnableCrosshairHighlightOperation,
451
+ Y as SetCrosshairHighlightColorOperation,
452
+ g as SheetsCrosshairHighlightService,
481
453
  M as ToggleCrosshairHighlightOperation,
482
- k as UniverSheetsCrosshairHighlightPlugin
454
+ A as UniverSheetsCrosshairHighlightPlugin
483
455
  };
@@ -1,5 +1,8 @@
1
1
  import { IEventBase, Injector, FUniver } from '@univerjs/core';
2
2
  import { FWorkbook, FWorksheet } from '@univerjs/sheets/facade';
3
+ /**
4
+ * @ignore
5
+ */
3
6
  export interface IFSheetCrosshairHighlightEventMixin {
4
7
  /**
5
8
  * Triggered when the crosshair highlight is enabled or disabled.
@@ -54,14 +57,23 @@ export interface ICrosshairHighlightColorChangedEvent extends IEventBase {
54
57
  */
55
58
  worksheet: FWorksheet;
56
59
  }
60
+ /**
61
+ * @ignore
62
+ */
57
63
  export declare class FSheetCrosshairHighlightEventMixin implements IFSheetCrosshairHighlightEventMixin {
58
64
  get CrosshairHighlightEnabledChanged(): 'CrosshairHighlightEnabledChanged';
59
65
  get CrosshairHighlightColorChanged(): 'CrosshairHighlightColorChanged';
60
66
  }
67
+ /**
68
+ * @ignore
69
+ */
61
70
  export interface ISheetCrosshairHighlightEventConfigs {
62
71
  CrosshairHighlightEnabledChanged: ICrosshairHighlightEnabledChangedEvent;
63
72
  CrosshairHighlightColorChanged: ICrosshairHighlightColorChangedEvent;
64
73
  }
74
+ /**
75
+ * @ignore
76
+ */
65
77
  export interface IFUniverCrosshairHighlightMixin {
66
78
  /**
67
79
  * Enable or disable crosshair highlight.
@@ -106,7 +118,13 @@ export interface IFUniverCrosshairHighlightMixin {
106
118
  */
107
119
  readonly CROSSHAIR_HIGHLIGHT_COLORS: string[];
108
120
  }
121
+ /**
122
+ * @ignore
123
+ */
109
124
  export declare class FUniverCrosshairHighlightMixin extends FUniver implements IFUniverCrosshairHighlightMixin {
125
+ /**
126
+ * @ignore
127
+ */
110
128
  _initialize(injector: Injector): void;
111
129
  setCrosshairHighlightEnabled(enabled: boolean): FUniver;
112
130
  setCrosshairHighlightColor(color: string): FUniver;
package/lib/umd/index.js CHANGED
@@ -1,9 +1 @@
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"),require("@univerjs/sheets-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","@univerjs/ui","rxjs","react","@univerjs/sheets","@univerjs/sheets-ui"],o):(c=typeof globalThis<"u"?globalThis:c||self,o(c.UniverSheetsCrosshairHighlight={},c.UniverCore,c.UniverEngineRender,c.UniverUi,c.rxjs,c.React,c.UniverSheets,c.UniverSheetsUi))})(this,function(c,o,p,H,_,R,w,P){"use strict";var be=Object.defineProperty;var Oe=(c,o,p)=>o in c?be(c,o,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[o]=p;var u=(c,o,p)=>Oe(c,typeof o!="symbol"?o+"":o,p);var T;const J="sheets-crosshair-highlight.config",A={};var d=function(){return d=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},d.apply(this,arguments)},X=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t},L=R.forwardRef(function(r,e){var t=r.icon,n=r.id,i=r.className,s=r.extend,a=X(r,["icon","id","className","extend"]),h="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),l=R.useRef("_".concat(Q()));return U(t,"".concat(n),{defIds:t.defIds,idSuffix:l.current},d({ref:e,className:h},a),s)});function U(r,e,t,n,i){return R.createElement(r.tag,d(d({key:e},K(r,t,i)),n),(z(r,t).children||[]).map(function(s,a){return U(s,"".concat(e,"-").concat(r.tag,"-").concat(a),t,void 0,i)}))}function K(r,e,t){var n=d({},r.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1);var i=e.defIds;return!i||i.length===0||(r.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(s){var a=s[0],h=s[1];typeof h=="string"&&(n[a]=h.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function z(r,e){var t,n=e.defIds;return!n||n.length===0?r:r.tag==="defs"&&(!((t=r.children)===null||t===void 0)&&t.length)?d(d({},r),{children:r.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?d(d({},i),{attrs:d(d({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):r}function Q(){return Math.random().toString(36).substring(2,8)}L.displayName="UniverIcon";var ee={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=R.forwardRef(function(r,e){return R.createElement(L,Object.assign({},r,{id:"cross-highlighting-single",ref:e,icon:ee}))});G.displayName="CrossHighlightingSingle";const M=["rgba(158, 109, 227, 0.3)","rgba(254, 75, 75, 0.3)","rgba(255, 140, 81, 0.3)","rgba(164, 220, 22, 0.3)","rgba(45, 174, 255, 0.3)","rgba(58, 96, 247, 0.3)","rgba(242, 72, 166, 0.3)","rgba(153, 153, 153, 0.3)","rgba(158, 109, 227, 0.15)","rgba(254, 75, 75, 0.15)","rgba(255, 140, 81, 0.15)","rgba(164, 220, 22, 0.15)","rgba(45, 174, 255, 0.15)","rgba(58, 96, 247, 0.15)","rgba(242, 72, 166, 0.15)","rgba(153, 153, 153, 0.15)"];class S extends o.Disposable{constructor(){super(...arguments);u(this,"_enabled$",new _.BehaviorSubject(!1));u(this,"enabled$",this._enabled$.asObservable());u(this,"_color$",new _.BehaviorSubject(M[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(r){const e=r.get(S),t=e.enabled;return e.setEnabled(!t),!0}},j={id:"sheet.operation.set-crosshair-highlight-color",type:o.CommandType.OPERATION,handler(r,{value:e}){const t=r.get(S);return t.enabled||t.setEnabled(!0),t.setColor(e),!0}},D={id:"sheet.operation.enable-crosshair-highlight",type:o.CommandType.OPERATION,handler(r){const e=r.get(S);return e.enabled?!1:(e.setEnabled(!0),!0)}},Y={id:"sheet.operation.disable-crosshair-highlight",type:o.CommandType.OPERATION,handler(r){const e=r.get(S);return e.enabled?(e.setEnabled(!1),!0):!1}};var N={exports:{}},b={};/**
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 k;function te(){if(k)return b;k=1;var r=R,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(h,l,C){var g,v={},m=null,f=null;C!==void 0&&(m=""+C),l.key!==void 0&&(m=""+l.key),l.ref!==void 0&&(f=l.ref);for(g in l)n.call(l,g)&&!s.hasOwnProperty(g)&&(v[g]=l[g]);if(h&&h.defaultProps)for(g in l=h.defaultProps,l)v[g]===void 0&&(v[g]=l[g]);return{$$typeof:e,type:h,key:m,ref:f,props:v,_owner:i.current}}return b.Fragment=t,b.jsx=a,b.jsxs=a,b}var B;function ne(){return B||(B=1,N.exports=te()),N.exports}var Z=ne();function F(r){var e,t,n="";if(typeof r=="string"||typeof r=="number")n+=r;else if(typeof r=="object")if(Array.isArray(r)){var i=r.length;for(e=0;e<i;e++)r[e]&&(t=F(r[e]))&&(n&&(n+=" "),n+=t)}else for(t in r)r[t]&&(n&&(n+=" "),n+=t);return n}function re(){for(var r,e,t=0,n="",i=arguments.length;t<i;t++)(r=arguments[t])&&(e=F(r))&&(n&&(n+=" "),n+=e);return n}const x={crosshairHighlightOverlay:"univer-crosshair-highlight-overlay",crosshairHighlightItem:"univer-crosshair-highlight-item",crosshairHighlightItemSelected:"univer-crosshair-highlight-item-selected"};function ie(r){const{onChange:e}=r,t=o.useDependency(S),n=o.useObservable(t.color$),i=R.useCallback(s=>{e==null||e(s)},[e]);return Z.jsx("div",{className:x.crosshairHighlightOverlay,children:M.map(s=>Z.jsx("div",{className:re(x.crosshairHighlightItem,{[x.crosshairHighlightItemSelected]:s===n}),style:{backgroundColor:s},onClick:()=>i(s)},s))})}const W="CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";function se(r){const e=r.get(S);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(r,o.UniverInstanceType.UNIVER_SHEET)}}const oe={[H.ContextMenuPosition.FOOTER_MENU]:{[H.ContextMenuGroup.OTHERS]:{[I.id]:{order:0,menuItemFactory:se}}}};var ae=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,he=(r,e,t,n)=>{for(var i=n>1?void 0:n?ce(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&ae(e,t,i),i},$=(r,e)=>(t,n)=>e(t,n,r);let y=class extends o.Disposable{constructor(r,e,t){super(),this._componentMgr=r,this._menuManagerService=e,this._cmdSrv=t,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[I,j,D,Y].forEach(r=>this._cmdSrv.registerCommand(r))}_initMenus(){this._menuManagerService.mergeMenu(oe)}_initComponents(){this._componentMgr.register(W,ie),this._componentMgr.register("CrossHighlightingSingle",G)}};y=he([$(0,o.Inject(H.ComponentManager)),$(1,H.IMenuManagerService),$(2,o.ICommandService)],y);const le=1;class ge{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),n=this._getSplitRanges(e,t);n.length>0&&this._ranges.push(...n)}setSelectedRanges(e){this._selectedRanges=e}_getSplitRanges(e,t){let n=[e];for(const i of t.concat(this._selectedRanges)){const s=[];for(const a of n){const h=o.Rectangle.subtract(a,i);h&&h.length>0&&s.push(...h)}n=s}return n.filter(i=>i.startRow<=i.endRow&&i.startColumn<=i.endColumn)}_getIntersects(e){const t=[];for(const n of this._ranges){const i=o.Rectangle.getIntersects(n,e);i&&t.push(i)}return t}getRanges(){return this._ranges}reset(){this._ranges=[],this._selectedRanges=[]}}class ue extends p.Shape{constructor(t,n){super(t,n);u(this,"_color");n&&this.setShapeProps(n)}setShapeProps(t){typeof t.color<"u"&&(this._color=t.color),this.transformByState({width:t.width,height:t.height})}_draw(t){const n=`rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${this._color.a})`;p.Rect.drawWith(t,{width:this.width,height:this.height,fill:n,stroke:void 0,strokeWidth:0,evented:!1})}}var de=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,_e=(r,e,t,n)=>{for(var i=n>1?void 0:n?fe(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&de(e,t,i),i},O=(r,e)=>(t,n)=>e(t,n,r);let E=class extends o.Disposable{constructor(e,t,n,i,s,a){super();u(this,"_shapes",[]);u(this,"_rangeCollection",new ge);u(this,"_color","rgba(255,0,0,0.5)");this._context=e,this._sheetSkeletonManagerService=t,this._sheetsSelectionsService=n,this._sheetsCrosshairHighlightService=i,this._contextService=s,this._refSelectionsService=a,this._initRenderListener()}_transformSelection(e,t){if(!e)return;const n=t.getRowCount(),i=t.getColumnCount(),s=[];for(const a of e){const{startRow:h,endRow:l,startColumn:C,endColumn:g}=a.range;l-h+1===n||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$(w.REF_SELECTIONS_ENABLED).pipe(_.startWith(!1)),this._sheetSkeletonManagerService.currentSkeleton$,this._sheetsCrosshairHighlightService.enabled$,this._sheetsCrosshairHighlightService.color$.pipe(_.tap(t=>this._color=t)),_.merge(this._sheetsSelectionsService.selectionMoveStart$,this._sheetsSelectionsService.selectionMoving$,this._sheetsSelectionsService.selectionMoveEnd$,this._sheetsSelectionsService.selectionSet$,e.activeSheet$.pipe(_.map(()=>this._sheetsSelectionsService.getCurrentSelections()))),_.merge(this._refSelectionsService.selectionMoveStart$,this._refSelectionsService.selectionMoving$,this._refSelectionsService.selectionMoveEnd$,this._sheetsSelectionsService.selectionSet$,e.activeSheet$.pipe(_.map(()=>this._refSelectionsService.getCurrentSelections())))]).subscribe(([t,n,i,s,a,h])=>{if(this._clear(),!i)return;const l=t?h:a;this._rangeCollection.reset(),this._transformSelection(l,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 n=t.getRowCount(),i=t.getColumnCount(),{startRow:s,endRow:a,startColumn:h,endColumn:l}=e,C={startRow:s,endRow:a,startColumn:0,endColumn:h-1},g={startRow:s,endRow:a,startColumn:l+1,endColumn:i},v={startRow:0,endRow:s-1,startColumn:h,endColumn:l},m={startRow:a+1,endRow:n,startColumn:h,endColumn:l};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,n,i){const{startRow:s,endRow:a,startColumn:h,endColumn:l}=e,C=P.getCoordByCell(s,h,n,i),g=P.getCoordByCell(a,l,n,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:le,evented:!1},q=new ue(`crosshair-${t}`,He);this._shapes.push(q),n.addObject(q)}render(e){const t=this._sheetSkeletonManagerService.getCurrentSkeleton();if(!t)return;const{scene:n}=this._context;this._clear();for(let i=0;i<e.length;i++){const s=e[i];this._addShapes(s,i,n,t)}n.makeDirty(!0)}async dispose(){super.dispose()}};E=_e([O(1,o.Inject(P.SheetSkeletonManagerService)),O(2,o.Inject(w.SheetsSelectionsService)),O(3,o.Inject(S)),O(4,o.Inject(o.IContextService)),O(5,w.IRefSelectionsService)],E);var Se=Object.defineProperty,ve=Object.getOwnPropertyDescriptor,pe=(r,e,t,n)=>{for(var i=n>1?void 0:n?ve(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Se(e,t,i),i},V=(r,e)=>(t,n)=>e(t,n,r);c.UniverSheetsCrosshairHighlightPlugin=(T=class extends o.Plugin{constructor(e=A,t,n,i){super(),this._config=e,this._injector=t,this._renderManagerService=n,this._configService=i;const{...s}=o.merge({},A,this._config);this._configService.setConfig(J,s)}onStarting(){[[S],[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([V(1,o.Inject(o.Injector)),V(2,p.IRenderManagerService),V(3,o.IConfigService)],c.UniverSheetsCrosshairHighlightPlugin),c.CROSSHAIR_HIGHLIGHT_COLORS=M,c.DisableCrosshairHighlightOperation=Y,c.EnableCrosshairHighlightOperation=D,c.SetCrosshairHighlightColorOperation=j,c.SheetsCrosshairHighlightService=S,c.ToggleCrosshairHighlightOperation=I,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(h,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("rxjs"),require("react/jsx-runtime"),require("react"),require("@univerjs/sheets"),require("@univerjs/sheets-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","@univerjs/ui","rxjs","react/jsx-runtime","react","@univerjs/sheets","@univerjs/sheets-ui"],s):(h=typeof globalThis<"u"?globalThis:h||self,s(h.UniverSheetsCrosshairHighlight={},h.UniverCore,h.UniverEngineRender,h.UniverUi,h.rxjs,h.React,h.React,h.UniverSheets,h.UniverSheetsUi))})(this,function(h,s,_,v,d,V,C,T,w){"use strict";var ve=Object.defineProperty;var Ce=(h,s,_)=>s in h?ve(h,s,{enumerable:!0,configurable:!0,writable:!0,value:_}):h[s]=_;var l=(h,s,_)=>Ce(h,typeof s!="symbol"?s+"":s,_);var I;const q="sheets-crosshair-highlight.config",A={};var g=function(){return g=Object.assign||function(n){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},g.apply(this,arguments)},W=function(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(n);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(n,i[r])&&(t[i[r]]=n[i[r]]);return t},L=C.forwardRef(function(n,e){var t=n.icon,i=n.id,r=n.className,o=n.extend,a=W(n,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(i," ").concat(r||"").trim(),u=C.useRef("_".concat(X()));return x(t,"".concat(i),{defIds:t.defIds,idSuffix:u.current},g({ref:e,className:c},a),o)});function x(n,e,t,i,r){return C.createElement(n.tag,g(g({key:e},k(n,t,r)),i),(F(n,t).children||[]).map(function(o,a){return x(o,"".concat(e,"-").concat(n.tag,"-").concat(a),t,void 0,r)}))}function k(n,e,t){var i=g({},n.attrs);t!=null&&t.colorChannel1&&i.fill==="colorChannel1"&&(i.fill=t.colorChannel1);var r=e.defIds;return!r||r.length===0||(n.tag==="use"&&i["xlink:href"]&&(i["xlink:href"]=i["xlink:href"]+e.idSuffix),Object.entries(i).forEach(function(o){var a=o[0],c=o[1];typeof c=="string"&&(i[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),i}function F(n,e){var t,i=e.defIds;return!i||i.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?g(g({},n),{children:n.children.map(function(r){return typeof r.attrs.id=="string"&&i&&i.indexOf(r.attrs.id)>-1?g(g({},r),{attrs:g(g({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):n}function X(){return Math.random().toString(36).substring(2,8)}L.displayName="UniverIcon";var K={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=C.forwardRef(function(n,e){return C.createElement(L,Object.assign({},n,{id:"cross-highlighting-single",ref:e,icon:K}))});G.displayName="CrossHighlightingSingle";const M=["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 f extends s.Disposable{constructor(){super(...arguments);l(this,"_enabled$",new d.BehaviorSubject(!1));l(this,"enabled$",this._enabled$.asObservable());l(this,"_color$",new d.BehaviorSubject(M[0]));l(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 R={id:"sheet.operation.toggle-crosshair-highlight",type:s.CommandType.OPERATION,handler(n){const e=n.get(f),t=e.enabled;return e.setEnabled(!t),!0}},P={id:"sheet.operation.set-crosshair-highlight-color",type:s.CommandType.OPERATION,handler(n,{value:e}){const t=n.get(f);return t.enabled||t.setEnabled(!0),t.setColor(e),!0}},U={id:"sheet.operation.enable-crosshair-highlight",type:s.CommandType.OPERATION,handler(n){const e=n.get(f);return e.enabled?!1:(e.setEnabled(!0),!0)}},D={id:"sheet.operation.disable-crosshair-highlight",type:s.CommandType.OPERATION,handler(n){const e=n.get(f);return e.enabled?(e.setEnabled(!1),!0):!1}};function Y(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;e<r;e++)n[e]&&(t=Y(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function z(){for(var n,e,t=0,i="",r=arguments.length;t<r;t++)(n=arguments[t])&&(e=Y(n))&&(i&&(i+=" "),i+=e);return i}const $={crosshairHighlightOverlay:"univer-crosshair-highlight-overlay",crosshairHighlightItem:"univer-crosshair-highlight-item",crosshairHighlightItemSelected:"univer-crosshair-highlight-item-selected"};function J(n){const{onChange:e}=n,t=s.useDependency(f),i=s.useObservable(t.color$),r=C.useCallback(o=>{e==null||e(o)},[e]);return V.jsx("div",{className:$.crosshairHighlightOverlay,children:M.map(o=>V.jsx("div",{className:z($.crosshairHighlightItem,{[$.crosshairHighlightItemSelected]:o===i}),style:{backgroundColor:o},onClick:()=>r(o)},o))})}const B="CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";function Q(n){const e=n.get(f);return{id:R.id,tooltip:"crosshair.button.tooltip",type:v.MenuItemType.BUTTON_SELECTOR,icon:"CrossHighlightingSingle",selections:[{label:{name:B,hoverable:!1}}],selectionsCommandId:P.id,activated$:e.enabled$,hidden$:v.getMenuHiddenObservable(n,s.UniverInstanceType.UNIVER_SHEET)}}const ee={[v.ContextMenuPosition.FOOTER_MENU]:{[v.ContextMenuGroup.OTHERS]:{[R.id]:{order:0,menuItemFactory:Q}}}};var te=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,ne=(n,e,t,i)=>{for(var r=i>1?void 0:i?ie(e,t):e,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&te(e,t,r),r},j=(n,e)=>(t,i)=>e(t,i,n);let b=class extends s.Disposable{constructor(n,e,t){super(),this._componentMgr=n,this._menuManagerService=e,this._cmdSrv=t,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[R,P,U,D].forEach(n=>this._cmdSrv.registerCommand(n))}_initMenus(){this._menuManagerService.mergeMenu(ee)}_initComponents(){this._componentMgr.register(B,J),this._componentMgr.register("CrossHighlightingSingle",G)}};b=ne([j(0,s.Inject(v.ComponentManager)),j(1,v.IMenuManagerService),j(2,s.ICommandService)],b);const re=1;class se{constructor(){l(this,"_selectedRanges",[]);l(this,"_ranges",[])}addRange(e){if(e.rangeType===s.RANGE_TYPE.COLUMN||e.rangeType===s.RANGE_TYPE.ROW||e.rangeType===s.RANGE_TYPE.ALL)return;const t=this._getIntersects(e),i=this._getSplitRanges(e,t);i.length>0&&this._ranges.push(...i)}setSelectedRanges(e){this._selectedRanges=e}_getSplitRanges(e,t){let i=[e];for(const r of t.concat(this._selectedRanges)){const o=[];for(const a of i){const c=s.Rectangle.subtract(a,r);c&&c.length>0&&o.push(...c)}i=o}return i.filter(r=>r.startRow<=r.endRow&&r.startColumn<=r.endColumn)}_getIntersects(e){const t=[];for(const i of this._ranges){const r=s.Rectangle.getIntersects(i,e);r&&t.push(r)}return t}getRanges(){return this._ranges}reset(){this._ranges=[],this._selectedRanges=[]}}class oe extends _.Shape{constructor(t,i){super(t,i);l(this,"_color");i&&this.setShapeProps(i)}setShapeProps(t){typeof t.color<"u"&&(this._color=t.color),this.transformByState({width:t.width,height:t.height})}_draw(t){const i=`rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${this._color.a})`;_.Rect.drawWith(t,{width:this.width,height:this.height,fill:i,stroke:void 0,strokeWidth:0,evented:!1})}}var ae=Object.defineProperty,he=Object.getOwnPropertyDescriptor,ce=(n,e,t,i)=>{for(var r=i>1?void 0:i?he(e,t):e,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&ae(e,t,r),r},p=(n,e)=>(t,i)=>e(t,i,n);let O=class extends s.Disposable{constructor(e,t,i,r,o,a){super();l(this,"_shapes",[]);l(this,"_rangeCollection",new se);l(this,"_color","rgba(255,0,0,0.5)");this._context=e,this._sheetSkeletonManagerService=t,this._sheetsSelectionsService=i,this._sheetsCrosshairHighlightService=r,this._contextService=o,this._refSelectionsService=a,this._initRenderListener()}_transformSelection(e,t){if(!e)return;const i=t.getRowCount(),r=t.getColumnCount(),o=[];for(const a of e){const{startRow:c,endRow:u,startColumn:m,endColumn:H}=a.range;u-c+1===i||H-m+1===r||o.push(a.range)}this._rangeCollection.setSelectedRanges(o);for(const a of o)this.addSelection(a,t)}_initRenderListener(){const e=this._context.unit;this.disposeWithMe(d.combineLatest([this._contextService.subscribeContextValue$(T.REF_SELECTIONS_ENABLED).pipe(d.startWith(!1)),this._sheetSkeletonManagerService.currentSkeleton$,this._sheetsCrosshairHighlightService.enabled$,this._sheetsCrosshairHighlightService.color$.pipe(d.tap(t=>this._color=t)),d.merge(this._sheetsSelectionsService.selectionMoveStart$,this._sheetsSelectionsService.selectionMoving$,this._sheetsSelectionsService.selectionMoveEnd$,this._sheetsSelectionsService.selectionSet$,e.activeSheet$.pipe(d.map(()=>this._sheetsSelectionsService.getCurrentSelections()))),d.merge(this._refSelectionsService.selectionMoveStart$,this._refSelectionsService.selectionMoving$,this._refSelectionsService.selectionMoveEnd$,this._sheetsSelectionsService.selectionSet$,e.activeSheet$.pipe(d.map(()=>this._refSelectionsService.getCurrentSelections())))]).subscribe(([t,i,r,o,a,c])=>{if(this._clear(),!r)return;const u=t?c:a;this._rangeCollection.reset(),this._transformSelection(u,e.getActiveSheet()),this.render(this._rangeCollection.getRanges())}))}addSelection(e,t){if(e.rangeType===s.RANGE_TYPE.COLUMN||e.rangeType===s.RANGE_TYPE.ROW||e.rangeType===s.RANGE_TYPE.ALL)return;const i=t.getRowCount(),r=t.getColumnCount(),{startRow:o,endRow:a,startColumn:c,endColumn:u}=e,m={startRow:o,endRow:a,startColumn:0,endColumn:c-1},H={startRow:o,endRow:a,startColumn:u+1,endColumn:r},E={startRow:0,endRow:o-1,startColumn:c,endColumn:u},y={startRow:a+1,endRow:i,startColumn:c,endColumn:u};for(const S of[m,H,E,y])S.startRow<=S.endRow&&S.startColumn<=S.endColumn&&this._rangeCollection.addRange(S)}_clear(){this._shapes.forEach(e=>{e.dispose()}),this._shapes=[]}_addShapes(e,t,i,r){const{startRow:o,endRow:a,startColumn:c,endColumn:u}=e,m=w.getCoordByCell(o,c,i,r),H=w.getCoordByCell(a,u,i,r),{startX:E,startY:y}=m,{endX:S,endY:de}=H,fe=S-E,_e=de-y,Se={left:E,top:y,color:new s.ColorKit(this._color).toRgb(),width:fe,height:_e,zIndex:re,evented:!1},Z=new oe(`crosshair-${t}`,Se);this._shapes.push(Z),i.addObject(Z)}render(e){const t=this._sheetSkeletonManagerService.getCurrentSkeleton();if(!t)return;const{scene:i}=this._context;this._clear();for(let r=0;r<e.length;r++){const o=e[r];this._addShapes(o,r,i,t)}i.makeDirty(!0)}async dispose(){super.dispose()}};O=ce([p(1,s.Inject(w.SheetSkeletonManagerService)),p(2,s.Inject(T.SheetsSelectionsService)),p(3,s.Inject(f)),p(4,s.Inject(s.IContextService)),p(5,T.IRefSelectionsService)],O);var le=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,ue=(n,e,t,i)=>{for(var r=i>1?void 0:i?ge(e,t):e,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&&le(e,t,r),r},N=(n,e)=>(t,i)=>e(t,i,n);h.UniverSheetsCrosshairHighlightPlugin=(I=class extends s.Plugin{constructor(e=A,t,i,r){super(),this._config=e,this._injector=t,this._renderManagerService=i,this._configService=r;const{...o}=s.merge({},A,this._config);this._configService.setConfig(q,o)}onStarting(){[[f],[b]].forEach(e=>this._injector.add(e))}onReady(){[[O]].forEach(e=>this._injector.add(e)),this._injector.get(b),this._renderManagerService.registerRenderModule(s.UniverInstanceType.UNIVER_SHEET,[O])}},l(I,"pluginName","SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"),l(I,"type",s.UniverInstanceType.UNIVER_SHEET),I),h.UniverSheetsCrosshairHighlightPlugin=ue([N(1,s.Inject(s.Injector)),N(2,_.IRenderManagerService),N(3,s.IConfigService)],h.UniverSheetsCrosshairHighlightPlugin),h.CROSSHAIR_HIGHLIGHT_COLORS=M,h.DisableCrosshairHighlightOperation=D,h.EnableCrosshairHighlightOperation=U,h.SetCrosshairHighlightColorOperation=P,h.SheetsCrosshairHighlightService=f,h.ToggleCrosshairHighlightOperation=R,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-crosshair-highlight",
3
- "version": "0.5.5",
3
+ "version": "0.6.0-experimental.20250125-1d060b9",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -53,17 +53,17 @@
53
53
  "lib"
54
54
  ],
55
55
  "peerDependencies": {
56
- "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
56
+ "react": ">=16.9.0 || >=17 || >=18 || >=19",
57
57
  "rxjs": ">=7.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@univerjs/icons": "^0.2.12",
60
+ "@univerjs/icons": "^0.2.14",
61
61
  "clsx": "^2.1.1",
62
- "@univerjs/core": "0.5.5",
63
- "@univerjs/sheets": "0.5.5",
64
- "@univerjs/engine-render": "0.5.5",
65
- "@univerjs/sheets-ui": "0.5.5",
66
- "@univerjs/ui": "0.5.5"
62
+ "@univerjs/engine-render": "0.6.0-experimental.20250125-1d060b9",
63
+ "@univerjs/sheets": "0.6.0-experimental.20250125-1d060b9",
64
+ "@univerjs/core": "0.6.0-experimental.20250125-1d060b9",
65
+ "@univerjs/sheets-ui": "0.6.0-experimental.20250125-1d060b9",
66
+ "@univerjs/ui": "0.6.0-experimental.20250125-1d060b9"
67
67
  },
68
68
  "devDependencies": {
69
69
  "less": "^4.2.1",
@@ -71,10 +71,10 @@
71
71
  "react": "18.3.1",
72
72
  "rxjs": "^7.8.1",
73
73
  "tailwindcss": "^3.4.17",
74
- "typescript": "^5.7.2",
74
+ "typescript": "^5.7.3",
75
75
  "vite": "^6.0.7",
76
76
  "vitest": "^2.1.8",
77
- "@univerjs-infra/shared": "0.5.5"
77
+ "@univerjs-infra/shared": "0.6.0-alpha.0"
78
78
  },
79
79
  "scripts": {
80
80
  "test": "vitest run",
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS