@univerjs/sheets-crosshair-highlight 0.6.0-alpha.0 → 0.6.0-experimental.20250212-dbe9830
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +32 -25
- package/lib/es/index.js +14 -14
- package/lib/types/const.d.ts +1 -1
- package/lib/types/facade/index.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/locale/zh-CN.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +10 -10
- package/LICENSE +0 -176
package/lib/cjs/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const h=require("@univerjs/core"),i=require("@univerjs/sheets-crosshair-highlight");class o extends h.FUniver{_initialize(e){const s=e.get(h.ICommandService);this.
|
|
1
|
+
"use strict";const h=require("@univerjs/core"),i=require("@univerjs/sheets-crosshair-highlight");class o extends h.FUniver{_initialize(e){const s=e.get(h.ICommandService);this.registerEventHandler(this.Event.CrosshairHighlightEnabledChanged,()=>s.onCommandExecuted(r=>{if(r.id===i.EnableCrosshairHighlightOperation.id||r.id===i.DisableCrosshairHighlightOperation.id){const t=this.getActiveSheet();if(!t)return;this.fireEvent(this.Event.CrosshairHighlightEnabledChanged,{enabled:this.getCrosshairHighlightEnabled(),...t})}})),this.registerEventHandler(this.Event.CrosshairHighlightColorChanged,()=>s.onCommandExecuted(r=>{if(r.id===i.SetCrosshairHighlightColorOperation.id){const t=this.getActiveSheet();if(!t)return;this.fireEvent(this.Event.CrosshairHighlightColorChanged,{color:this.getCrosshairHighlightColor(),...t})}}))}setCrosshairHighlightEnabled(e){return e?this._commandService.syncExecuteCommand(i.EnableCrosshairHighlightOperation.id):this._commandService.syncExecuteCommand(i.DisableCrosshairHighlightOperation.id),this}setCrosshairHighlightColor(e){return this._commandService.syncExecuteCommand(i.SetCrosshairHighlightColorOperation.id,{value:e}),this}getCrosshairHighlightEnabled(){return this._injector.get(i.SheetsCrosshairHighlightService).enabled}getCrosshairHighlightColor(){return this._injector.get(i.SheetsCrosshairHighlightService).color}get CROSSHAIR_HIGHLIGHT_COLORS(){return i.CROSSHAIR_HIGHLIGHT_COLORS}}h.FUniver.extend(o);
|
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"),f=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=f.useDependency(d),r=f.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:f.MenuItemType.BUTTON_SELECTOR,icon:"CrossHighlightingSingle",selections:[{label:{name:B,hoverable:!1}}],selectionsCommandId:j.id,activated$:e.enabled$,hidden$:f.getMenuHiddenObservable(n,a.UniverInstanceType.UNIVER_SHEET)}}const ce={[f.ContextMenuPosition.FOOTER_MENU]:{[f.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(f.ComponentManager)),y(1,f.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 _ of[v,C,m,H])_.startRow<=_.endRow&&_.startColumn<=_.endColumn&&this._rangeCollection.addRange(_)}_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:_,endY:Z}=C,q=_-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,35 +1,42 @@
|
|
|
1
|
-
import { FUniver as
|
|
2
|
-
import { EnableCrosshairHighlightOperation as h, DisableCrosshairHighlightOperation as
|
|
3
|
-
class c extends
|
|
1
|
+
import { FUniver as g, ICommandService as a } from "@univerjs/core";
|
|
2
|
+
import { EnableCrosshairHighlightOperation as h, DisableCrosshairHighlightOperation as s, SetCrosshairHighlightColorOperation as o, SheetsCrosshairHighlightService as n, CROSSHAIR_HIGHLIGHT_COLORS as l } from "@univerjs/sheets-crosshair-highlight";
|
|
3
|
+
class c extends g {
|
|
4
4
|
/**
|
|
5
5
|
* @ignore
|
|
6
6
|
*/
|
|
7
7
|
_initialize(i) {
|
|
8
|
-
const
|
|
9
|
-
this.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
const r = i.get(a);
|
|
9
|
+
this.registerEventHandler(
|
|
10
|
+
this.Event.CrosshairHighlightEnabledChanged,
|
|
11
|
+
() => r.onCommandExecuted((t) => {
|
|
12
|
+
if (t.id === h.id || t.id === s.id) {
|
|
13
|
+
const e = this.getActiveSheet();
|
|
14
|
+
if (!e) return;
|
|
15
|
+
this.fireEvent(this.Event.CrosshairHighlightEnabledChanged, {
|
|
16
|
+
enabled: this.getCrosshairHighlightEnabled(),
|
|
17
|
+
...e
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
), this.registerEventHandler(
|
|
22
|
+
this.Event.CrosshairHighlightColorChanged,
|
|
23
|
+
() => r.onCommandExecuted((t) => {
|
|
24
|
+
if (t.id === o.id) {
|
|
25
|
+
const e = this.getActiveSheet();
|
|
26
|
+
if (!e) return;
|
|
27
|
+
this.fireEvent(this.Event.CrosshairHighlightColorChanged, {
|
|
28
|
+
color: this.getCrosshairHighlightColor(),
|
|
29
|
+
...e
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
);
|
|
27
34
|
}
|
|
28
35
|
setCrosshairHighlightEnabled(i) {
|
|
29
|
-
return i ? this._commandService.syncExecuteCommand(h.id) : this._commandService.syncExecuteCommand(
|
|
36
|
+
return i ? this._commandService.syncExecuteCommand(h.id) : this._commandService.syncExecuteCommand(s.id), this;
|
|
30
37
|
}
|
|
31
38
|
setCrosshairHighlightColor(i) {
|
|
32
|
-
return this._commandService.syncExecuteCommand(
|
|
39
|
+
return this._commandService.syncExecuteCommand(o.id, {
|
|
33
40
|
value: i
|
|
34
41
|
}), this;
|
|
35
42
|
}
|
|
@@ -43,4 +50,4 @@ class c extends o {
|
|
|
43
50
|
return l;
|
|
44
51
|
}
|
|
45
52
|
}
|
|
46
|
-
|
|
53
|
+
g.extend(c);
|
package/lib/es/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var J = Object.defineProperty;
|
|
2
2
|
var Q = (n, e, t) => e in n ? J(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var c = (n, e, t) => Q(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { Disposable as w, CommandType as R,
|
|
5
|
-
import { Shape as
|
|
6
|
-
import { MenuItemType as de, getMenuHiddenObservable as ue, ContextMenuPosition as fe, ContextMenuGroup as _e, ComponentManager as Se, IMenuManagerService as ve } from "@univerjs/ui";
|
|
4
|
+
import { Disposable as w, CommandType as R, UniverInstanceType as y, Inject as u, ICommandService as ee, RANGE_TYPE as f, Rectangle as T, IContextService as te, ColorKit as re, Plugin as ne, merge as se, Injector as ie, IConfigService as oe } from "@univerjs/core";
|
|
5
|
+
import { Shape as ae, Rect as ce, IRenderManagerService as le } from "@univerjs/engine-render";
|
|
6
|
+
import { useDependency as he, useObservable as ge, MenuItemType as de, getMenuHiddenObservable as ue, ContextMenuPosition as fe, ContextMenuGroup as _e, ComponentManager as Se, IMenuManagerService as ve } from "@univerjs/ui";
|
|
7
7
|
import { BehaviorSubject as x, combineLatest as pe, startWith as me, tap as Ce, merge as P, map as V } from "rxjs";
|
|
8
8
|
import { jsx as N } from "react/jsx-runtime";
|
|
9
9
|
import { forwardRef as G, useRef as be, createElement as U, useCallback as He } from "react";
|
|
@@ -151,7 +151,7 @@ const je = "univer-crosshair-highlight-overlay", Le = "univer-crosshair-highligh
|
|
|
151
151
|
crosshairHighlightItemSelected: Ae
|
|
152
152
|
};
|
|
153
153
|
function Ge(n) {
|
|
154
|
-
const { onChange: e } = n, t =
|
|
154
|
+
const { onChange: e } = n, t = he(g), r = ge(t.color$), s = He((i) => {
|
|
155
155
|
e == null || e(i);
|
|
156
156
|
}, [e]);
|
|
157
157
|
return /* @__PURE__ */ N("div", { className: O.crosshairHighlightOverlay, children: W.map((i) => /* @__PURE__ */ N(
|
|
@@ -224,7 +224,7 @@ let b = class extends w {
|
|
|
224
224
|
b = We([
|
|
225
225
|
I(0, u(Se)),
|
|
226
226
|
I(1, ve),
|
|
227
|
-
I(2,
|
|
227
|
+
I(2, ee)
|
|
228
228
|
], b);
|
|
229
229
|
const Ye = 1;
|
|
230
230
|
class ke {
|
|
@@ -268,7 +268,7 @@ class ke {
|
|
|
268
268
|
this._ranges = [], this._selectedRanges = [];
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
class Fe extends
|
|
271
|
+
class Fe extends ae {
|
|
272
272
|
constructor(t, r) {
|
|
273
273
|
super(t, r);
|
|
274
274
|
// protected _showHighLight = false;
|
|
@@ -283,7 +283,7 @@ class Fe extends le {
|
|
|
283
283
|
}
|
|
284
284
|
_draw(t) {
|
|
285
285
|
const r = `rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${this._color.a})`;
|
|
286
|
-
|
|
286
|
+
ce.drawWith(t, {
|
|
287
287
|
width: this.width,
|
|
288
288
|
height: this.height,
|
|
289
289
|
fill: r,
|
|
@@ -381,7 +381,7 @@ let H = class extends w {
|
|
|
381
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
382
|
left: p,
|
|
383
383
|
top: m,
|
|
384
|
-
color: new
|
|
384
|
+
color: new re(this._color).toRgb(),
|
|
385
385
|
width: K,
|
|
386
386
|
height: z,
|
|
387
387
|
zIndex: Ye,
|
|
@@ -409,7 +409,7 @@ H = ze([
|
|
|
409
409
|
v(1, u(Ee)),
|
|
410
410
|
v(2, u(Re)),
|
|
411
411
|
v(3, u(g)),
|
|
412
|
-
v(4, u(
|
|
412
|
+
v(4, u(te)),
|
|
413
413
|
v(5, Ie)
|
|
414
414
|
], H);
|
|
415
415
|
var qe = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, Qe = (n, e, t, r) => {
|
|
@@ -417,10 +417,10 @@ var qe = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, Qe = (n, e
|
|
|
417
417
|
(o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
418
418
|
return r && s && qe(e, t, s), s;
|
|
419
419
|
}, E = (n, e) => (t, r) => e(t, r, n), C;
|
|
420
|
-
let A = (C = class extends
|
|
420
|
+
let A = (C = class extends ne {
|
|
421
421
|
constructor(n = L, e, t, r) {
|
|
422
422
|
super(), this._config = n, this._injector = e, this._renderManagerService = t, this._configService = r;
|
|
423
|
-
const { ...s } =
|
|
423
|
+
const { ...s } = se(
|
|
424
424
|
{},
|
|
425
425
|
L,
|
|
426
426
|
this._config
|
|
@@ -440,9 +440,9 @@ let A = (C = class extends ie {
|
|
|
440
440
|
}
|
|
441
441
|
}, c(C, "pluginName", "SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"), c(C, "type", y.UNIVER_SHEET), C);
|
|
442
442
|
A = Qe([
|
|
443
|
-
E(1, u(
|
|
444
|
-
E(2,
|
|
445
|
-
E(3,
|
|
443
|
+
E(1, u(ie)),
|
|
444
|
+
E(2, le),
|
|
445
|
+
E(3, oe)
|
|
446
446
|
], A);
|
|
447
447
|
export {
|
|
448
448
|
W as CROSSHAIR_HIGHLIGHT_COLORS,
|
package/lib/types/const.d.ts
CHANGED
package/lib/types/index.d.ts
CHANGED
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,i){typeof exports=="object"&&typeof module<"u"?i(require("@univerjs/core"),require("@univerjs/sheets-crosshair-highlight")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-crosshair-highlight"],i):(e=typeof globalThis<"u"?globalThis:e||self,i(e.UniverCore,e.UniverSheetsCrosshairHighlight))})(this,function(e,i){"use strict";class
|
|
1
|
+
(function(e,i){typeof exports=="object"&&typeof module<"u"?i(require("@univerjs/core"),require("@univerjs/sheets-crosshair-highlight")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-crosshair-highlight"],i):(e=typeof globalThis<"u"?globalThis:e||self,i(e.UniverCore,e.UniverSheetsCrosshairHighlight))})(this,function(e,i){"use strict";class s extends e.FUniver{_initialize(t){const n=t.get(e.ICommandService);this.registerEventHandler(this.Event.CrosshairHighlightEnabledChanged,()=>n.onCommandExecuted(h=>{if(h.id===i.EnableCrosshairHighlightOperation.id||h.id===i.DisableCrosshairHighlightOperation.id){const r=this.getActiveSheet();if(!r)return;this.fireEvent(this.Event.CrosshairHighlightEnabledChanged,{enabled:this.getCrosshairHighlightEnabled(),...r})}})),this.registerEventHandler(this.Event.CrosshairHighlightColorChanged,()=>n.onCommandExecuted(h=>{if(h.id===i.SetCrosshairHighlightColorOperation.id){const r=this.getActiveSheet();if(!r)return;this.fireEvent(this.Event.CrosshairHighlightColorChanged,{color:this.getCrosshairHighlightColor(),...r})}}))}setCrosshairHighlightEnabled(t){return t?this._commandService.syncExecuteCommand(i.EnableCrosshairHighlightOperation.id):this._commandService.syncExecuteCommand(i.DisableCrosshairHighlightOperation.id),this}setCrosshairHighlightColor(t){return this._commandService.syncExecuteCommand(i.SetCrosshairHighlightColorOperation.id,{value:t}),this}getCrosshairHighlightEnabled(){return this._injector.get(i.SheetsCrosshairHighlightService).enabled}getCrosshairHighlightColor(){return this._injector.get(i.SheetsCrosshairHighlightService).color}get CROSSHAIR_HIGHLIGHT_COLORS(){return i.CROSSHAIR_HIGHLIGHT_COLORS}}e.FUniver.extend(s)});
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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"})});
|
|
1
|
+
(function(h,o){typeof exports=="object"&&typeof module<"u"?o(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"],o):(h=typeof globalThis<"u"?globalThis:h||self,o(h.UniverSheetsCrosshairHighlight={},h.UniverCore,h.UniverEngineRender,h.UniverUi,h.rxjs,h.React,h.React,h.UniverSheets,h.UniverSheetsUi))})(this,function(h,o,_,S,d,V,C,T,w){"use strict";var ve=Object.defineProperty;var Ce=(h,o,_)=>o in h?ve(h,o,{enumerable:!0,configurable:!0,writable:!0,value:_}):h[o]=_;var l=(h,o,_)=>Ce(h,typeof o!="symbol"?o+"":o,_);var I;const q="sheets-crosshair-highlight.config",A={};var g=function(){return g=Object.assign||function(i){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},g.apply(this,arguments)},W=function(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(t[n[r]]=i[n[r]]);return t},L=C.forwardRef(function(i,e){var t=i.icon,n=i.id,r=i.className,s=i.extend,a=W(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),u=C.useRef("_".concat(X()));return x(t,"".concat(n),{defIds:t.defIds,idSuffix:u.current},g({ref:e,className:c},a),s)});function x(i,e,t,n,r){return C.createElement(i.tag,g(g({key:e},k(i,t,r)),n),(F(i,t).children||[]).map(function(s,a){return x(s,"".concat(e,"-").concat(i.tag,"-").concat(a),t,void 0,r)}))}function k(i,e,t){var n=g({},i.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1);var r=e.defIds;return!r||r.length===0||(i.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(s){var a=s[0],c=s[1];typeof c=="string"&&(n[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function F(i,e){var t,n=e.defIds;return!n||n.length===0?i:i.tag==="defs"&&(!((t=i.children)===null||t===void 0)&&t.length)?g(g({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?g(g({},r),{attrs:g(g({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):i}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(i,e){return C.createElement(L,Object.assign({},i,{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 o.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:o.CommandType.OPERATION,handler(i){const e=i.get(f),t=e.enabled;return e.setEnabled(!t),!0}},P={id:"sheet.operation.set-crosshair-highlight-color",type:o.CommandType.OPERATION,handler(i,{value:e}){const t=i.get(f);return t.enabled||t.setEnabled(!0),t.setColor(e),!0}},U={id:"sheet.operation.enable-crosshair-highlight",type:o.CommandType.OPERATION,handler(i){const e=i.get(f);return e.enabled?!1:(e.setEnabled(!0),!0)}},D={id:"sheet.operation.disable-crosshair-highlight",type:o.CommandType.OPERATION,handler(i){const e=i.get(f);return e.enabled?(e.setEnabled(!1),!0):!1}};function Y(i){var e,t,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i)){var r=i.length;for(e=0;e<r;e++)i[e]&&(t=Y(i[e]))&&(n&&(n+=" "),n+=t)}else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function z(){for(var i,e,t=0,n="",r=arguments.length;t<r;t++)(i=arguments[t])&&(e=Y(i))&&(n&&(n+=" "),n+=e);return n}const $={crosshairHighlightOverlay:"univer-crosshair-highlight-overlay",crosshairHighlightItem:"univer-crosshair-highlight-item",crosshairHighlightItemSelected:"univer-crosshair-highlight-item-selected"};function J(i){const{onChange:e}=i,t=S.useDependency(f),n=S.useObservable(t.color$),r=C.useCallback(s=>{e==null||e(s)},[e]);return V.jsx("div",{className:$.crosshairHighlightOverlay,children:M.map(s=>V.jsx("div",{className:z($.crosshairHighlightItem,{[$.crosshairHighlightItemSelected]:s===n}),style:{backgroundColor:s},onClick:()=>r(s)},s))})}const B="CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";function Q(i){const e=i.get(f);return{id:R.id,tooltip:"crosshair.button.tooltip",type:S.MenuItemType.BUTTON_SELECTOR,icon:"CrossHighlightingSingle",selections:[{label:{name:B,hoverable:!1}}],selectionsCommandId:P.id,activated$:e.enabled$,hidden$:S.getMenuHiddenObservable(i,o.UniverInstanceType.UNIVER_SHEET)}}const ee={[S.ContextMenuPosition.FOOTER_MENU]:{[S.ContextMenuGroup.OTHERS]:{[R.id]:{order:0,menuItemFactory:Q}}}};var te=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,ie=(i,e,t,n)=>{for(var r=n>1?void 0:n?ne(e,t):e,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(e,t,r):a(r))||r);return n&&r&&te(e,t,r),r},j=(i,e)=>(t,n)=>e(t,n,i);let b=class extends o.Disposable{constructor(i,e,t){super(),this._componentMgr=i,this._menuManagerService=e,this._cmdSrv=t,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[R,P,U,D].forEach(i=>this._cmdSrv.registerCommand(i))}_initMenus(){this._menuManagerService.mergeMenu(ee)}_initComponents(){this._componentMgr.register(B,J),this._componentMgr.register("CrossHighlightingSingle",G)}};b=ie([j(0,o.Inject(S.ComponentManager)),j(1,S.IMenuManagerService),j(2,o.ICommandService)],b);const re=1;class se{constructor(){l(this,"_selectedRanges",[]);l(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 r of t.concat(this._selectedRanges)){const s=[];for(const a of n){const c=o.Rectangle.subtract(a,r);c&&c.length>0&&s.push(...c)}n=s}return n.filter(r=>r.startRow<=r.endRow&&r.startColumn<=r.endColumn)}_getIntersects(e){const t=[];for(const n of this._ranges){const r=o.Rectangle.getIntersects(n,e);r&&t.push(r)}return t}getRanges(){return this._ranges}reset(){this._ranges=[],this._selectedRanges=[]}}class oe extends _.Shape{constructor(t,n){super(t,n);l(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})`;_.Rect.drawWith(t,{width:this.width,height:this.height,fill:n,stroke:void 0,strokeWidth:0,evented:!1})}}var ae=Object.defineProperty,he=Object.getOwnPropertyDescriptor,ce=(i,e,t,n)=>{for(var r=n>1?void 0:n?he(e,t):e,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(e,t,r):a(r))||r);return n&&r&&ae(e,t,r),r},p=(i,e)=>(t,n)=>e(t,n,i);let O=class extends o.Disposable{constructor(e,t,n,r,s,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=n,this._sheetsCrosshairHighlightService=r,this._contextService=s,this._refSelectionsService=a,this._initRenderListener()}_transformSelection(e,t){if(!e)return;const n=t.getRowCount(),r=t.getColumnCount(),s=[];for(const a of e){const{startRow:c,endRow:u,startColumn:m,endColumn:H}=a.range;u-c+1===n||H-m+1===r||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(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,n,r,s,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===o.RANGE_TYPE.COLUMN||e.rangeType===o.RANGE_TYPE.ROW||e.rangeType===o.RANGE_TYPE.ALL)return;const n=t.getRowCount(),r=t.getColumnCount(),{startRow:s,endRow:a,startColumn:c,endColumn:u}=e,m={startRow:s,endRow:a,startColumn:0,endColumn:c-1},H={startRow:s,endRow:a,startColumn:u+1,endColumn:r},E={startRow:0,endRow:s-1,startColumn:c,endColumn:u},y={startRow:a+1,endRow:n,startColumn:c,endColumn:u};for(const v of[m,H,E,y])v.startRow<=v.endRow&&v.startColumn<=v.endColumn&&this._rangeCollection.addRange(v)}_clear(){this._shapes.forEach(e=>{e.dispose()}),this._shapes=[]}_addShapes(e,t,n,r){const{startRow:s,endRow:a,startColumn:c,endColumn:u}=e,m=w.getCoordByCell(s,c,n,r),H=w.getCoordByCell(a,u,n,r),{startX:E,startY:y}=m,{endX:v,endY:de}=H,fe=v-E,_e=de-y,Se={left:E,top:y,color:new o.ColorKit(this._color).toRgb(),width:fe,height:_e,zIndex:re,evented:!1},Z=new oe(`crosshair-${t}`,Se);this._shapes.push(Z),n.addObject(Z)}render(e){const t=this._sheetSkeletonManagerService.getCurrentSkeleton();if(!t)return;const{scene:n}=this._context;this._clear();for(let r=0;r<e.length;r++){const s=e[r];this._addShapes(s,r,n,t)}n.makeDirty(!0)}async dispose(){super.dispose()}};O=ce([p(1,o.Inject(w.SheetSkeletonManagerService)),p(2,o.Inject(T.SheetsSelectionsService)),p(3,o.Inject(f)),p(4,o.Inject(o.IContextService)),p(5,T.IRefSelectionsService)],O);var le=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,ue=(i,e,t,n)=>{for(var r=n>1?void 0:n?ge(e,t):e,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(e,t,r):a(r))||r);return n&&r&&le(e,t,r),r},N=(i,e)=>(t,n)=>e(t,n,i);h.UniverSheetsCrosshairHighlightPlugin=(I=class extends o.Plugin{constructor(e=A,t,n,r){super(),this._config=e,this._injector=t,this._renderManagerService=n,this._configService=r;const{...s}=o.merge({},A,this._config);this._configService.setConfig(q,s)}onStarting(){[[f],[b]].forEach(e=>this._injector.add(e))}onReady(){[[O]].forEach(e=>this._injector.add(e)),this._injector.get(b),this._renderManagerService.registerRenderModule(o.UniverInstanceType.UNIVER_SHEET,[O])}},l(I,"pluginName","SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"),l(I,"type",o.UniverInstanceType.UNIVER_SHEET),I),h.UniverSheetsCrosshairHighlightPlugin=ue([N(1,o.Inject(o.Injector)),N(2,_.IRenderManagerService),N(3,o.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.6.0-
|
|
3
|
+
"version": "0.6.0-experimental.20250212-dbe9830",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -59,21 +59,21 @@
|
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@univerjs/icons": "^0.2.14",
|
|
61
61
|
"clsx": "^2.1.1",
|
|
62
|
-
"@univerjs/core": "0.6.0-
|
|
63
|
-
"@univerjs/engine-render": "0.6.0-
|
|
64
|
-
"@univerjs/sheets": "0.6.0-
|
|
65
|
-
"@univerjs/sheets-ui": "0.6.0-
|
|
66
|
-
"@univerjs/ui": "0.6.0-
|
|
62
|
+
"@univerjs/core": "0.6.0-experimental.20250212-dbe9830",
|
|
63
|
+
"@univerjs/engine-render": "0.6.0-experimental.20250212-dbe9830",
|
|
64
|
+
"@univerjs/sheets": "0.6.0-experimental.20250212-dbe9830",
|
|
65
|
+
"@univerjs/sheets-ui": "0.6.0-experimental.20250212-dbe9830",
|
|
66
|
+
"@univerjs/ui": "0.6.0-experimental.20250212-dbe9830"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"less": "^4.2.
|
|
70
|
-
"postcss": "^8.
|
|
69
|
+
"less": "^4.2.2",
|
|
70
|
+
"postcss": "^8.5.1",
|
|
71
71
|
"react": "18.3.1",
|
|
72
72
|
"rxjs": "^7.8.1",
|
|
73
73
|
"tailwindcss": "^3.4.17",
|
|
74
74
|
"typescript": "^5.7.3",
|
|
75
|
-
"vite": "^6.0.
|
|
76
|
-
"vitest": "^
|
|
75
|
+
"vite": "^6.0.11",
|
|
76
|
+
"vitest": "^3.0.4",
|
|
77
77
|
"@univerjs-infra/shared": "0.6.0-alpha.0"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
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
|