@univerjs/preset-sheets-find-replace 0.10.12-nightly.202510221114 → 0.10.13

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.
Files changed (2) hide show
  1. package/lib/umd/index.js +1 -1
  2. package/package.json +5 -5
package/lib/umd/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @univerjs/find-replace/index
2
- (function(d,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/ui"),require("@univerjs/design"),require("@univerjs/engine-render"),require("rxjs"),require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/ui","@univerjs/design","@univerjs/engine-render","rxjs","react/jsx-runtime","react"],o):(d=typeof globalThis<"u"?globalThis:d||self,o(d.UniverFindReplace={},d.UniverCore,d.UniverUi,d.UniverDesign,d.UniverEngineRender,d.rxjs,d.React,d.React))})(this,(function(d,o,c,_,oe,v,h,f){"use strict";var ot=Object.defineProperty;var ct=(d,o,c)=>o in d?ot(d,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[o]=c;var u=(d,o,c)=>ct(d,typeof o!="symbol"?o+"":o,c);var G;const K="FIND_REPLACE_INPUT_FOCUS",H="FIND_REPLACE_DIALOG_FOCUS",q="FIND_REPLACE_REPLACE_REVEALED";var ce=Object.getOwnPropertyDescriptor,Z=(i,e,n,t)=>{for(var a=t>1?void 0:t?ce(e,n):e,s=i.length-1,r;s>=0;s--)(r=i[s])&&(a=r(a)||a);return a},P=(i,e)=>(n,t)=>e(n,t,i);class le extends o.Disposable{}const S=o.createIdentifier("find-replace.service");function de(i){return typeof i.findString<"u"||typeof i.inputtingFindString<"u"||typeof i.findDirection<"u"||typeof i.matchesTheWholeCell<"u"||typeof i.caseSensitive<"u"||typeof i.findScope<"u"||typeof i.findBy<"u"}d.FindReplaceModel=class extends o.Disposable{constructor(n,t,a,s){super();u(this,"currentMatch$",new v.BehaviorSubject(null));u(this,"replaceables$",new v.BehaviorSubject([]));u(this,"_findModels",[]);u(this,"_matchingModel",null);u(this,"_matches",[]);u(this,"_currentSearchingDisposables",null);this._state=n,this._providers=t,this._univerInstanceService=a,this._commandService=s,this.disposeWithMe(this._state.stateUpdates$.pipe(v.throttleTime(200,void 0,{leading:!0,trailing:!0})).subscribe(async r=>{const l=this._state.state;de(r)&&(l.findString!==""&&!l.replaceRevealed?(await this._startSearching(),this._state.changeState({findCompleted:!0})):r.replaceRevealed!==!0&&this._stopSearching())}))}get searched(){return this._findModels.length>0}dispose(){super.dispose(),this._stopSearching(),this.currentMatch$.complete(),this.replaceables$.complete(),this._state.changeState({...$(),revealed:!1})}async start(){if(!this._state.findString)return{results:[]};const n=await this._startSearching();return this._state.changeState({findCompleted:!0}),n}focusSelection(){var n;(n=this._matchingModel)==null||n.focusSelection()}async _startSearching(){if(!this._state.findString)return{results:[]};const n=Array.from(this._providers),t=this._findModels=(await Promise.all(n.map(s=>s.find({findString:this._state.findString,findDirection:this._state.findDirection,findScope:this._state.findScope,findBy:this._state.findBy,replaceRevealed:this._state.replaceRevealed,caseSensitive:this._state.caseSensitive,matchesTheWholeCell:this._state.matchesTheWholeCell})))).flat();this._subscribeToModelsChanges(t);const a=this._matches=t.map(s=>s.getMatches()).flat();return this.replaceables$.next(a.filter(s=>s.replaceable)),a.length?(this._moveToInitialMatch(t),this._state.changeState({matchesCount:a.length}),{results:a}):(this._state.changeState({matchesCount:0,matchesPosition:0}),{results:[]})}_stopSearching(){var n;this._providers.forEach(t=>t.terminate()),this._findModels=[],this._matches=[],this._matchingModel=null,(n=this._currentSearchingDisposables)==null||n.dispose(),this._currentSearchingDisposables=null,this.currentMatch$.next(null),this.replaceables$.next([]),this._state.changeState({findCompleted:!1,matchesCount:0,matchesPosition:0})}_subscribeToModelsChanges(n){const t=this._currentSearchingDisposables=new o.DisposableCollection,a=v.combineLatest(n.map(s=>s.matchesUpdate$)).pipe(v.debounceTime(220)).subscribe(([...s])=>{const r=this._matches=s.flat();r.length?(this._moveToInitialMatch(this._findModels,!0),this._state.changeState({matchesCount:r.length}),this.replaceables$.next(r.filter(l=>l.replaceable))):(this._state.changeState({matchesCount:0,matchesPosition:0}),this.replaceables$.next([]))});n.forEach(s=>t.add(o.toDisposable(s.activelyChangingMatch$.subscribe(r=>{const l=this._matches.findIndex(p=>p===r);this._state.changeState({matchesPosition:l+1})})))),t.add(o.toDisposable(a))}async replace(){return this._matchingModel?this._matchingModel.replace(this._state.replaceString):!1}async replaceAll(){const n=await Promise.all(this._findModels.map(t=>t.replaceAll(this._state.replaceString))).then(t=>t.reduce((a,s)=>(a.success+=s.success,a.failure+=s.failure,a),{success:0,failure:0}));return n.failure===0&&this._stopSearching(),n}getCurrentMatch(){return this._state.matchesPosition>0?this._matches[this._state.matchesPosition-1]:null}_markMatch(n){const t=this._matches.findIndex(a=>a===n);this.currentMatch$.next(n),this._state.changeState({matchesPosition:t+1})}moveToNextMatch(){if(!this._matchingModel)return;const n=this._findModels.length===1,t=this._matchingModel.moveToNextMatch({loop:n});if(t)return this._markMatch(t),t;{const a=this._findModels.findIndex(s=>s===this._matchingModel);return this._moveToNextUnitMatch(a)}}_moveToNextUnitMatch(n){const t=this._findModels.length;for(let a=(n+1)%t;a!==n;){const s=this._findModels[a],r=s.moveToNextMatch({ignoreSelection:!0});if(r)return this._matchingModel=s,this._markMatch(r),r;a=(a+1)%t}if(this._matchingModel){const a=this._matchingModel.moveToNextMatch({ignoreSelection:!0});return a&&this._markMatch(a),a}}moveToPreviousMatch(){if(!this._matchingModel)return;const n=this._findModels.length===1,t=this._matchingModel.moveToPreviousMatch({loop:n});if(t){const a=this._matches.findIndex(s=>s===t);return this.currentMatch$.next(t),this._state.changeState({matchesPosition:a+1}),t}else{const a=this._findModels.length,s=this._findModels.findIndex(l=>l===this._matchingModel);for(let l=(s-1+a)%a;l!==s;){const p=this._findModels[l],m=p.moveToPreviousMatch({ignoreSelection:!0});if(m)return this._matchingModel=p,this._markMatch(m),m;l=(l-1)%a}const r=this._matchingModel.moveToPreviousMatch({ignoreSelection:!0});return r&&this._markMatch(r),r}}_moveToInitialMatch(n,t=!1){var r;const a=(r=this._univerInstanceService.getFocusedUnit())==null?void 0:r.getUnitId();if(!a)return-1;const s=n.findIndex(l=>l.unitId===a);if(s!==-1){this._matchingModel=n[s];const l=this._matchingModel.moveToNextMatch({stayIfOnMatch:!0,noFocus:t});if(l)return this._markMatch(l),s}return this._moveToNextUnitMatch(s),0}},d.FindReplaceModel=Z([P(2,o.IUniverInstanceService),P(3,o.ICommandService)],d.FindReplaceModel);var E=(i=>(i.ROW="row",i.COLUMN="column",i))(E||{}),N=(i=>(i.VALUE="value",i.FORMULA="formula",i))(N||{}),L=(i=>(i.SUBUNIT="subunit",i.UNIT="unit",i))(L||{});function $(){return{caseSensitive:!1,findBy:"value",findCompleted:!1,findDirection:"row",findScope:"subunit",findString:"",inputtingFindString:"",matchesCount:0,matchesPosition:0,matchesTheWholeCell:!1,replaceRevealed:!1,replaceString:"",revealed:!0}}class z{constructor(){u(this,"_stateUpdates$",new v.Subject);u(this,"stateUpdates$",this._stateUpdates$.asObservable());u(this,"_state$",new v.BehaviorSubject($()));u(this,"state$",this._state$.asObservable());u(this,"_findString","");u(this,"_inputtingFindString","");u(this,"_replaceString","");u(this,"_revealed",!1);u(this,"_replaceRevealed",!1);u(this,"_matchesPosition",0);u(this,"_matchesCount",0);u(this,"_caseSensitive",!0);u(this,"_matchesTheWholeCell",!1);u(this,"_findDirection","row");u(this,"_findScope","subunit");u(this,"_findBy","value");u(this,"_findCompleted",!1)}get state(){return this._state$.getValue()}get inputtingFindString(){return this._inputtingFindString}get findString(){return this._findString}get revealed(){return this._revealed}get replaceRevealed(){return this._replaceRevealed}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get replaceString(){return this._replaceString}get caseSensitive(){return this._caseSensitive}get matchesTheWholeCell(){return this._matchesTheWholeCell}get findDirection(){return this._findDirection}get findScope(){return this._findScope}get findBy(){return this._findBy}get findCompleted(){return this._findCompleted}changeState(e){let n=!1;const t={};typeof e.findString<"u"&&e.findString!==this._findString&&(this._findString=e.findString,t.findString=this._findString,n=!0),typeof e.revealed<"u"&&e.revealed!==this._revealed&&(this._revealed=e.revealed,t.revealed=e.revealed,n=!0),typeof e.replaceRevealed<"u"&&e.replaceRevealed!==this._replaceRevealed&&(this._replaceRevealed=e.replaceRevealed,t.replaceRevealed=e.replaceRevealed,n=!0),typeof e.replaceString<"u"&&e.replaceString!==this._replaceString&&(this._replaceString=e.replaceString,t.replaceString=e.replaceString,n=!0),typeof e.matchesCount<"u"&&e.matchesCount!==this._matchesCount&&(this._matchesCount=e.matchesCount,t.matchesCount=e.matchesCount,n=!0),typeof e.matchesPosition<"u"&&e.matchesPosition!==this._matchesPosition&&(this._matchesPosition=e.matchesPosition,t.matchesPosition=e.matchesPosition,n=!0),typeof e.findBy<"u"&&e.findBy!==this._findBy&&(this._findBy=e.findBy,t.findBy=e.findBy,n=!0),typeof e.findScope<"u"&&e.findScope!==this._findScope&&(this._findScope=e.findScope,t.findScope=e.findScope,n=!0),typeof e.findDirection<"u"&&e.findDirection!==this._findDirection&&(this._findDirection=e.findDirection,t.findDirection=e.findDirection,n=!0),typeof e.caseSensitive<"u"&&e.caseSensitive!==this._caseSensitive&&(this._caseSensitive=e.caseSensitive,t.caseSensitive=e.caseSensitive,n=!0),typeof e.matchesTheWholeCell<"u"&&e.matchesTheWholeCell!==this._matchesTheWholeCell&&(this._matchesTheWholeCell=e.matchesTheWholeCell,t.matchesTheWholeCell=e.matchesTheWholeCell,n=!0),typeof e.inputtingFindString<"u"&&e.inputtingFindString!==this._inputtingFindString&&(this._inputtingFindString=e.inputtingFindString,t.inputtingFindString=e.inputtingFindString,n=!0),typeof e.findCompleted<"u"&&e.findCompleted!==this._findCompleted&&(this._findCompleted=e.findCompleted,t.findCompleted=e.findCompleted,n=!0),n&&(this._state$.next({caseSensitive:this._caseSensitive,findBy:this._findBy,findCompleted:this._findCompleted,findDirection:this._findDirection,findScope:this._findScope,findString:this._findString,inputtingFindString:this._inputtingFindString,matchesCount:this._matchesCount,matchesPosition:this._matchesPosition,matchesTheWholeCell:this._matchesTheWholeCell,replaceRevealed:this._replaceRevealed,revealed:this._revealed}),this._stateUpdates$.next(t))}}let x=class extends o.Disposable{constructor(e,n){super();u(this,"_providers",new Set);u(this,"_state",new z);u(this,"_model");u(this,"_currentMatch$",new v.BehaviorSubject(null));u(this,"currentMatch$",this._currentMatch$.asObservable());u(this,"_replaceables$",new v.BehaviorSubject([]));u(this,"replaceables$",this._replaceables$.asObservable());u(this,"_focusSignal$",new v.Subject);u(this,"focusSignal$",this._focusSignal$.asObservable());this._injector=e,this._contextService=n}get stateUpdates$(){return this._state.stateUpdates$}get state$(){return this._state.state$}get revealed(){return this._state.revealed}get replaceRevealed(){return this._state.replaceRevealed}dispose(){super.dispose(),this._currentMatch$.next(null),this._currentMatch$.complete(),this._replaceables$.next([]),this._replaceables$.complete(),this._focusSignal$.complete()}getProviders(){return this._providers}getCurrentMatch(){var e;return(e=this._model)==null?void 0:e.getCurrentMatch()}getFindString(){return this._state.findString}changeFindString(e){this._state.changeState({findString:e})}focusFindInput(){this._focusSignal$.next()}changeInputtingFindString(e){e?this._state.changeState({inputtingFindString:e}):this._state.changeState({inputtingFindString:"",findString:""})}changeReplaceString(e){this._state.changeState({replaceString:e})}changeMatchesTheWholeCell(e){this._state.changeState({matchesTheWholeCell:e})}changeCaseSensitive(e){this._state.changeState({caseSensitive:e})}changeFindBy(e){this._state.changeState({findBy:e}),this._toggleDisplayRawFormula(e==="formula")}changeFindScope(e){this._state.changeState({findScope:e})}changeFindDirection(e){this._state.changeState({findDirection:e})}moveToNextMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToNextMatch(),this._focusSignal$.next())}moveToPreviousMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToPreviousMatch(),this._focusSignal$.next())}async replace(){return this._model?this._model.replace():!1}async replaceAll(){if(!this._model)throw new Error("[FindReplaceService] replaceAll: model is not initialized!");return this._model.replaceAll()}revealReplace(){this._state.changeState({replaceRevealed:!0,inputtingFindString:this._state.findString}),this._toggleRevealReplace(!0)}focusSelection(){var e;(e=this._model)==null||e.focusSelection()}start(e=!1){if(this._providers.size===0)return!1;this._model=this._injector.createInstance(d.FindReplaceModel,this._state,this._providers),this._model.currentMatch$.subscribe(t=>this._currentMatch$.next(t)),this._model.replaceables$.subscribe(t=>this._replaceables$.next(t));const n=$();return e&&(n.replaceRevealed=!0),this._state.changeState(n),this._toggleRevealReplace(e),!0}find(){var e;(e=this._model)==null||e.start()}terminate(){var e;(e=this._model)==null||e.dispose(),this._model=null,this._toggleDisplayRawFormula(!1),this._toggleRevealReplace(!1)}registerFindReplaceProvider(e){return this._providers.add(e),o.toDisposable(()=>this._providers.delete(e))}_toggleRevealReplace(e){this._contextService.setContextValue(q,e)}_toggleDisplayRawFormula(e){this._contextService.setContextValue(oe.RENDER_RAW_FORMULA_KEY,e)}};x=Z([P(0,o.Inject(o.Injector)),P(1,o.IContextService)],x);const w={id:"ui.command.replace-current-match",type:o.CommandType.COMMAND,handler:i=>i.get(S).replace()},he="CONFIRM_REPLACE_ALL",U={id:"ui.command.replace-all-matches",type:o.CommandType.COMMAND,handler:async i=>{const e=i.get(c.IConfirmService),n=i.get(o.LocaleService),t=i.get(c.IMessageService);if(!await e.confirm({id:he,title:{title:n.t("find-replace.replace.confirm.title")},cancelText:n.t("button.cancel"),confirmText:n.t("button.confirm")}))return!1;const s=await i.get(S).replaceAll(),{success:r,failure:l}=s;return l>0?(r===0?t.show({type:_.MessageType.Error,content:n.t("find-replace.replace.all-failure")}):t.show({type:_.MessageType.Warning,content:n.t("find-replace.replace.partial-success",`${r}`,`${l}`)}),!1):(t.show({type:_.MessageType.Success,content:n.t("find-replace.replace.all-success",`${r}`)}),!0)}},R={id:"ui.operation.open-find-dialog",type:o.CommandType.OPERATION,handler:i=>{const e=i.get(S);return e.revealed?e.focusFindInput():e.start(),!0}},A={id:"ui.operation.open-replace-dialog",type:o.CommandType.OPERATION,handler:i=>{const e=i.get(S);return e.revealed?e.replaceRevealed?e.focusFindInput():e.revealReplace():e.start(!0),!0}},k={type:o.CommandType.OPERATION,id:"ui.operation.go-to-next-match",handler:i=>(i.get(S).moveToNextMatch(),!0)},B={type:o.CommandType.OPERATION,id:"ui.operation.go-to-previous-match",handler:i=>(i.get(S).moveToPreviousMatch(),!0)},Y={type:o.CommandType.OPERATION,id:"ui.operation.focus-selection",handler:i=>(i.get(S).focusSelection(),!0)};var M=function(){return M=Object.assign||function(i){for(var e,n=1,t=arguments.length;n<t;n++){e=arguments[n];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(i[a]=e[a])}return i},M.apply(this,arguments)},ue=function(i,e){var n={};for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&e.indexOf(t)<0&&(n[t]=i[t]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(i);a<t.length;a++)e.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(i,t[a])&&(n[t[a]]=i[t[a]]);return n},J=f.forwardRef(function(i,e){var n=i.icon,t=i.id,a=i.className,s=i.extend,r=ue(i,["icon","id","className","extend"]),l="univerjs-icon univerjs-icon-".concat(t," ").concat(a||"").trim(),p=f.useRef("_".concat(_e()));return Q(n,"".concat(t),{defIds:n.defIds,idSuffix:p.current},M({ref:e,className:l},r),s)});function Q(i,e,n,t,a){return f.createElement(i.tag,M(M({key:e},fe(i,n,a)),t),(pe(i,n).children||[]).map(function(s,r){return Q(s,"".concat(e,"-").concat(i.tag,"-").concat(r),n,void 0,a)}))}function fe(i,e,n){var t=M({},i.attrs);n!=null&&n.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=n.colorChannel1),i.tag==="mask"&&t.id&&(t.id=t.id+e.idSuffix),Object.entries(t).forEach(function(s){var r=s[0],l=s[1];r==="mask"&&typeof l=="string"&&(t[r]=l.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var a=e.defIds;return!a||a.length===0||(i.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+e.idSuffix),Object.entries(t).forEach(function(s){var r=s[0],l=s[1];typeof l=="string"&&(t[r]=l.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),t}function pe(i,e){var n,t=e.defIds;return!t||t.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?M(M({},i),{children:i.children.map(function(a){return typeof a.attrs.id=="string"&&t&&t.includes(a.attrs.id)?M(M({},a),{attrs:M(M({},a.attrs),{id:a.attrs.id+e.idSuffix})}):a})}):i}function _e(){return Math.random().toString(36).substring(2,8)}J.displayName="UniverIcon";var ge={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.71899 1.36938C4.37604 1.36938 1.66602 4.07941 1.66602 7.42236C1.66602 10.7653 4.37604 13.4753 7.71899 13.4753C9.16744 13.4753 10.4971 12.9666 11.5389 12.118L13.6598 14.4109C13.8848 14.6542 14.2644 14.669 14.5077 14.444C14.7509 14.219 14.7657 13.8393 14.5407 13.5961L12.3906 11.2716C13.2536 10.2254 13.772 8.88442 13.772 7.42236C13.772 4.07941 11.0619 1.36938 7.71899 1.36938ZM2.86602 7.42236C2.86602 4.74215 5.03878 2.56938 7.71899 2.56938C10.3992 2.56938 12.572 4.74215 12.572 7.42236C12.572 10.1026 10.3992 12.2753 7.71899 12.2753C5.03878 12.2753 2.86602 10.1026 2.86602 7.42236Z",fillRule:"evenodd",clipRule:"evenodd"}}]},X=f.forwardRef(function(i,e){return f.createElement(J,Object.assign({},i,{id:"search-icon",ref:e,icon:ge}))});X.displayName="SearchIcon";function ee(i){const{findCompleted:e,localeService:n,matchesCount:t,matchesPosition:a,initialFindString:s,findReplaceService:r,onChange:l,...p}=i,[m,C]=f.useState(s),T=e&&t===0?n.t("find-replace.dialog.no-result"):t===0?" ":void 0;function F(b){a===t&&b===1?r.moveToNextMatch():a===1&&b===t||b<a?r.moveToPreviousMatch():r.moveToNextMatch()}return h.jsx("div",{className:"univer-relative univer-flex univer-items-center univer-gap-2",onDrag:b=>b.stopPropagation(),children:h.jsx(_.Input,{"data-u-comp":"search-input",autoFocus:!0,placeholder:n.t("find-replace.dialog.find-placeholder"),value:m,onChange:b=>{C(b),l==null||l(b)},slot:h.jsx(_.Pager,{loop:!0,text:T,value:a,total:t,onChange:F}),...p})})}function te(i,e){const n=f.useCallback(()=>{var a;(a=document.querySelector(".univer-find-input input"))==null||a.focus()},[]),t=f.useCallback(()=>{const a=document.querySelectorAll("[data-u-comp=find-replace-dialog] [data-u-comp=search-input]");return Array.from(a).some(s=>s===document.activeElement)},[]);return f.useImperativeHandle(e,()=>({focus:n,selectHasFocus:t})),f.useEffect(()=>{const a=i.focusSignal$.subscribe(()=>n());return()=>a.unsubscribe()},[i,n]),{focus:n,selectHasFocus:t}}const ve=f.forwardRef(function(e,n){const t=c.useDependency(o.LocaleService),a=c.useDependency(S),s=c.useDependency(o.ICommandService),r=c.useObservable(a.state$,void 0,!0),{findCompleted:l,findString:p,matchesCount:m,matchesPosition:C}=r,I=f.useCallback(()=>{s.executeCommand(A.id)},[s]),T=c.useDebounceFn(F=>a.changeFindString(F),500);return te(a,n),h.jsxs(h.Fragment,{children:[h.jsx(ee,{findCompleted:l,matchesCount:m,matchesPosition:C,findReplaceService:a,localeService:t,initialFindString:p,onChange:T}),h.jsx("div",{className:"univer-mt-4 univer-text-center",children:h.jsx("a",{className:"hover:univer-text-primary-500/80 univer-cursor-pointer univer-text-sm univer-text-primary-500 univer-transition-colors",onClick:I,children:t.t("find-replace.dialog.advanced-finding")})})]})}),me=f.forwardRef(function(e,n){const t=c.useDependency(S),a=c.useDependency(o.LocaleService),s=c.useDependency(o.ICommandService),r=c.useDependency(c.IMessageService),l=c.useObservable(t.currentMatch$,void 0,!0),p=c.useObservable(t.replaceables$,void 0,!0),m=c.useObservable(t.state$,void 0,!0),{matchesCount:C,matchesPosition:I,findString:T,inputtingFindString:F,replaceString:b,caseSensitive:je,matchesTheWholeCell:We,findDirection:Ge,findScope:Ve,findBy:Ke,findCompleted:V}=m,He=F.length===0,qe=C===0||!(l!=null&&l.replaceable),Ze=p.length===0,ze=f.useCallback(g=>t.changeInputtingFindString(g),[t]),Ye=f.useCallback(g=>t.changeReplaceString(g),[t]),{focus:Je}=te(t,n),Qe=f.useCallback(()=>{T===F?t.moveToNextMatch():(t.changeFindString(F),t.find())},[T,F,t]),Xe=f.useCallback(()=>s.executeCommand(w.id),[s]),et=f.useCallback(async()=>{await s.executeCommand(U.id),Je()},[s]),tt=f.useCallback(g=>{t.changeFindDirection(g)},[t]),it=f.useCallback(g=>{t.changeFindScope(g)},[t]),nt=f.useCallback(g=>{t.changeFindBy(g)},[t]),at=Ce(a),st=Me(a),rt=be(a);return f.useEffect(()=>{V&&C===0&&r.show({content:a.t("find-replace.dialog.no-match"),type:_.MessageType.Warning,duration:5e3})},[V,C,r,a]),h.jsxs("div",{children:[h.jsx(_.FormLayout,{label:a.t("find-replace.dialog.find"),children:h.jsx(ee,{findCompleted:V,className:"univer-find-input",matchesCount:C,matchesPosition:I,findReplaceService:t,localeService:a,initialFindString:F,onChange:ze})}),h.jsx(_.FormLayout,{label:a.t("find-replace.dialog.replace"),children:h.jsx(_.Input,{placeholder:a.t("find-replace.dialog.replace-placeholder"),value:b,onChange:g=>Ye(g)})}),h.jsx(_.FormLayout,{label:a.t("find-replace.dialog.find-direction.title"),children:h.jsx(_.Select,{value:Ge,options:st,onChange:tt})}),h.jsx(_.FormDualColumnLayout,{children:h.jsxs(h.Fragment,{children:[h.jsx(_.FormLayout,{label:a.t("find-replace.dialog.find-scope.title"),children:h.jsx(_.Select,{value:Ve,options:at,onChange:it})}),h.jsx(_.FormLayout,{label:a.t("find-replace.dialog.find-by.title"),children:h.jsx(_.Select,{value:Ke,options:rt,onChange:nt})})]})}),h.jsx(_.FormDualColumnLayout,{children:h.jsxs(h.Fragment,{children:[h.jsx(_.FormLayout,{children:h.jsx(_.Checkbox,{checked:je,onChange:g=>{t.changeCaseSensitive(g)},children:a.t("find-replace.dialog.case-sensitive")})}),h.jsx(_.FormLayout,{children:h.jsx(_.Checkbox,{checked:We,onChange:g=>{t.changeMatchesTheWholeCell(g)},children:a.t("find-replace.dialog.match-the-whole-cell")})})]})}),h.jsxs("div",{className:"univer-mt-6 univer-flex univer-justify-between",children:[h.jsx(_.Button,{variant:"primary",onClick:Qe,disabled:He,children:a.t("find-replace.dialog.find")}),h.jsxs("span",{className:"univer-inline-flex univer-gap-2",children:[h.jsx(_.Button,{disabled:qe,onClick:Xe,children:a.t("find-replace.dialog.replace")}),h.jsx(_.Button,{disabled:Ze,onClick:et,children:a.t("find-replace.dialog.replace-all")})]})]})]})});function Se(){const i=c.useDependency(S),e=c.useDependency(c.ILayoutService),n=c.useDependency(o.IContextService),t=c.useObservable(i.state$,void 0,!0),a=f.useRef(null);f.useEffect(()=>{let p;return a.current&&(p=e.registerContainerElement(a.current)),()=>p==null?void 0:p.dispose()},[e]);const s=f.useRef(null),r=f.useCallback(p=>n.setContextValue(H,p),[n]),l=f.useCallback(p=>n.setContextValue(K,p),[n]);return f.useEffect(()=>{var m;const p=v.fromEvent(document,"focusin").subscribe(C=>{var I;C.target&&((I=a.current)!=null&&I.contains(C.target))?r(!0):r(!1),!s.current||!s.current.selectHasFocus()?l(!1):l(!0)});return(m=s.current)==null||m.focus(),r(!0),l(!0),()=>{p.unsubscribe(),r(!1)}},[r,l]),h.jsx("div",{ref:a,"data-u-comp":"find-replace-dialog",children:t.replaceRevealed?h.jsx(me,{ref:s}):h.jsx(ve,{ref:s})})}function Ce(i){const e=i.getCurrentLocale();return f.useMemo(()=>[{label:i.t("find-replace.dialog.find-scope.current-sheet"),value:L.SUBUNIT},{label:i.t("find-replace.dialog.find-scope.workbook"),value:L.UNIT}],[e])}function Me(i){const e=i.getCurrentLocale();return f.useMemo(()=>[{label:i.t("find-replace.dialog.find-direction.row"),value:E.ROW},{label:i.t("find-replace.dialog.find-direction.column"),value:E.COLUMN}],[e])}function be(i){const e=i.getCurrentLocale();return f.useMemo(()=>[{label:i.t("find-replace.dialog.find-by.value"),value:N.VALUE},{label:i.t("find-replace.dialog.find-by.formula"),value:N.FORMULA}],[e])}function D(i){return i.getContextValue(H)}function ye(i){return i.getContextValue(q)}function ie(i){return i.getContextValue(K)}const O="7_find-replace-shortcuts";function j(i){return i.getContextValue(o.FOCUSING_SHEET)}function W(i){return!i.getContextValue(o.EDITOR_ACTIVATED)}const Fe={id:R.id,description:"find-replace.shortcut.open-find-dialog",binding:c.KeyCode.F|c.MetaKeys.CTRL_COMMAND,group:O,preconditions(i){return!D(i)&&j(i)&&W(i)}},Ie={id:R.id,description:"find-replace.shortcut.open-find-dialog",binding:c.KeyCode.F|c.MetaKeys.CTRL_COMMAND,mac:c.KeyCode.F|c.MetaKeys.MAC_CTRL,preconditions(i){return!D(i)&&j(i)&&W(i)}},Re={id:A.id,description:"find-replace.shortcut.open-replace-dialog",binding:c.KeyCode.H|c.MetaKeys.CTRL_COMMAND,mac:c.KeyCode.H|c.MetaKeys.MAC_CTRL,group:O,preconditions(i){return j(i)&&W(i)&&(!D(i)||!ye(i))}},De={id:k.id,description:"find-replace.shortcut.go-to-next-match",binding:c.KeyCode.ENTER,group:O,priority:1e3,preconditions(i){return ie(i)&&D(i)}},Te={id:B.id,description:"find-replace.shortcut.go-to-previous-match",binding:c.KeyCode.ENTER|c.MetaKeys.SHIFT,group:O,priority:1e3,preconditions(i){return ie(i)&&D(i)}},Oe={id:Y.id,description:"find-replace.shortcut.focus-selection",binding:c.KeyCode.ESC,group:O,priority:1e3,preconditions(i){return D(i)}};function Pe(i){const e=i.get(o.IContextService);return{id:R.id,icon:"SearchIcon",tooltip:"find-replace.toolbar",type:c.MenuItemType.BUTTON,hidden$:c.getMenuHiddenObservable(i,o.UniverInstanceType.UNIVER_SHEET),disabled$:v.combineLatest([e.subscribeContextValue$(o.EDITOR_ACTIVATED),e.subscribeContextValue$(o.FOCUSING_SHEET)]).pipe(v.map(([n,t])=>n||!t))}}const Ee={[c.RibbonDataGroup.ORGANIZATION]:{[R.id]:{order:2,menuItemFactory:Pe}}};var Ne=Object.getOwnPropertyDescriptor,Le=(i,e,n,t)=>{for(var a=t>1?void 0:t?Ne(e,n):e,s=i.length-1,r;s>=0;s--)(r=i[s])&&(a=r(a)||a);return a},y=(i,e)=>(n,t)=>e(n,t,i);const ne="DESKTOP_FIND_REPLACE_DIALOG",ae=350,$e=20,Ae=64;d.FindReplaceController=class extends o.RxDisposable{constructor(n,t,a,s,r,l,p,m,C){super();u(this,"_closingListenerDisposable");this._univerInstanceService=n,this._menuManagerService=t,this._shortcutService=a,this._commandService=s,this._findReplaceService=r,this._dialogService=l,this._layoutService=p,this._localeService=m,this._componentManager=C,this._initCommands(),this._initUI(),this._initShortcuts()}dispose(){var n;super.dispose(),(n=this._closingListenerDisposable)==null||n.dispose(),this._closingListenerDisposable=null}_initCommands(){[R,A,k,B,U,w,Y].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initShortcuts(){[Re,Fe,Ie,Te,De,Oe].forEach(n=>this.disposeWithMe(this._shortcutService.registerShortcut(n)))}_initUI(){[["FindReplaceDialog",Se],["SearchIcon",X]].forEach(([n,t])=>{this.disposeWithMe(this._componentManager.register(n,t))}),this._menuManagerService.mergeMenu(Ee),this._findReplaceService.stateUpdates$.pipe(v.takeUntil(this.dispose$)).subscribe(n=>{n.revealed===!0&&this._openPanel()})}_openPanel(){this._dialogService.open({id:ne,draggable:!0,width:ae,title:{title:this._localeService.t("find-replace.dialog.title")},children:{label:"FindReplaceDialog"},destroyOnClose:!0,mask:!1,maskClosable:!1,defaultPosition:xe(),preservePositionOnDestroy:!0,onClose:()=>this.closePanel()}),this._closingListenerDisposable=o.toDisposable(this._univerInstanceService.focused$.pipe(v.takeUntil(this.dispose$)).subscribe(n=>{(!n||!this._univerInstanceService.getUniverSheetInstance(n))&&this.closePanel()}))}closePanel(){this._closingListenerDisposable&&(this._closingListenerDisposable.dispose(),this._closingListenerDisposable=null,this._dialogService.close(ne),this._findReplaceService.terminate(),queueMicrotask(()=>this._layoutService.focus()))}},d.FindReplaceController=Le([y(0,o.IUniverInstanceService),y(1,c.IMenuManagerService),y(2,c.IShortcutService),y(3,o.ICommandService),y(4,S),y(5,c.IDialogService),y(6,c.ILayoutService),y(7,o.Inject(o.LocaleService)),y(8,o.Inject(c.ComponentManager))],d.FindReplaceController);function xe(){const{innerWidth:i}=window;return{x:i-ae-$e,y:Ae}}const we="find-replace.config",se={};var Ue=Object.getOwnPropertyDescriptor,ke=(i,e,n,t)=>{for(var a=t>1?void 0:t?Ue(e,n):e,s=i.length-1,r;s>=0;s--)(r=i[s])&&(a=r(a)||a);return a},re=(i,e)=>(n,t)=>e(n,t,i);const Be="UNIVER_FIND_REPLACE_PLUGIN";d.UniverFindReplacePlugin=(G=class extends o.Plugin{constructor(e=se,n,t){super(),this._config=e,this._injector=n,this._configService=t;const{...a}=o.merge({},se,this._config);this._configService.setConfig(we,a)}onStarting(){[[d.FindReplaceController],[S,{useClass:x}]].forEach(e=>this._injector.add(e))}onRendered(){this._injector.get(d.FindReplaceController)}},u(G,"pluginName",Be),G),d.UniverFindReplacePlugin=ke([re(1,o.Inject(o.Injector)),re(2,o.IConfigService)],d.UniverFindReplacePlugin),d.FindBy=N,d.FindDirection=E,d.FindModel=le,d.FindReplaceState=z,d.FindScope=L,d.GoToNextMatchOperation=k,d.GoToPreviousMatchOperation=B,d.IFindReplaceService=S,d.OpenFindDialogOperation=R,d.OpenReplaceDialogOperation=A,d.ReplaceAllMatchesCommand=U,d.ReplaceCurrentMatchCommand=w,d.createInitFindReplaceState=$,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
2
+ (function(l,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/ui"),require("@univerjs/design"),require("@univerjs/engine-render"),require("rxjs"),require("react"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/ui","@univerjs/design","@univerjs/engine-render","rxjs","react","react/jsx-runtime"],o):(l=typeof globalThis<"u"?globalThis:l||self,o(l.UniverFindReplace={},l.UniverCore,l.UniverUi,l.UniverDesign,l.UniverEngineRender,l.rxjs,l.React,l.React))})(this,(function(l,o,c,_,re,m,p,h){"use strict";var at=Object.defineProperty;var rt=(l,o,c)=>o in l?at(l,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):l[o]=c;var u=(l,o,c)=>rt(l,typeof o!="symbol"?o+"":o,c);var j;const V="FIND_REPLACE_INPUT_FOCUS",K="FIND_REPLACE_DIALOG_FOCUS",H="FIND_REPLACE_REPLACE_REVEALED";var oe=Object.getOwnPropertyDescriptor,q=(i,e,n,t)=>{for(var s=t>1?void 0:t?oe(e,n):e,a=i.length-1,r;a>=0;a--)(r=i[a])&&(s=r(s)||s);return s},P=(i,e)=>(n,t)=>e(n,t,i);class ce extends o.Disposable{}const S=o.createIdentifier("find-replace.service");function le(i){return typeof i.findString<"u"||typeof i.inputtingFindString<"u"||typeof i.findDirection<"u"||typeof i.matchesTheWholeCell<"u"||typeof i.caseSensitive<"u"||typeof i.findScope<"u"||typeof i.findBy<"u"}l.FindReplaceModel=class extends o.Disposable{constructor(n,t,s,a){super();u(this,"currentMatch$",new m.BehaviorSubject(null));u(this,"replaceables$",new m.BehaviorSubject([]));u(this,"_findModels",[]);u(this,"_matchingModel",null);u(this,"_matches",[]);u(this,"_currentSearchingDisposables",null);this._state=n,this._providers=t,this._univerInstanceService=s,this._commandService=a,this.disposeWithMe(this._state.stateUpdates$.pipe(m.throttleTime(200,void 0,{leading:!0,trailing:!0})).subscribe(async r=>{const d=this._state.state;le(r)&&(d.findString!==""&&!d.replaceRevealed?(await this._startSearching(),this._state.changeState({findCompleted:!0})):r.replaceRevealed!==!0&&this._stopSearching())}))}get searched(){return this._findModels.length>0}dispose(){super.dispose(),this._stopSearching(),this.currentMatch$.complete(),this.replaceables$.complete(),this._state.changeState({...$(),revealed:!1})}async start(){if(!this._state.findString)return{results:[]};const n=await this._startSearching();return this._state.changeState({findCompleted:!0}),n}focusSelection(){var n;(n=this._matchingModel)==null||n.focusSelection()}async _startSearching(){if(!this._state.findString)return{results:[]};const n=Array.from(this._providers),t=this._findModels=(await Promise.all(n.map(a=>a.find({findString:this._state.findString,findDirection:this._state.findDirection,findScope:this._state.findScope,findBy:this._state.findBy,replaceRevealed:this._state.replaceRevealed,caseSensitive:this._state.caseSensitive,matchesTheWholeCell:this._state.matchesTheWholeCell})))).flat();this._subscribeToModelsChanges(t);const s=this._matches=t.map(a=>a.getMatches()).flat();return this.replaceables$.next(s.filter(a=>a.replaceable)),s.length?(this._moveToInitialMatch(t),this._state.changeState({matchesCount:s.length}),{results:s}):(this._state.changeState({matchesCount:0,matchesPosition:0}),{results:[]})}_stopSearching(){var n;this._providers.forEach(t=>t.terminate()),this._findModels=[],this._matches=[],this._matchingModel=null,(n=this._currentSearchingDisposables)==null||n.dispose(),this._currentSearchingDisposables=null,this.currentMatch$.next(null),this.replaceables$.next([]),this._state.changeState({findCompleted:!1,matchesCount:0,matchesPosition:0})}_subscribeToModelsChanges(n){const t=this._currentSearchingDisposables=new o.DisposableCollection,s=m.combineLatest(n.map(a=>a.matchesUpdate$)).pipe(m.debounceTime(220)).subscribe(([...a])=>{const r=this._matches=a.flat();r.length?(this._moveToInitialMatch(this._findModels,!0),this._state.changeState({matchesCount:r.length}),this.replaceables$.next(r.filter(d=>d.replaceable))):(this._state.changeState({matchesCount:0,matchesPosition:0}),this.replaceables$.next([]))});n.forEach(a=>t.add(o.toDisposable(a.activelyChangingMatch$.subscribe(r=>{const d=this._matches.findIndex(f=>f===r);this._state.changeState({matchesPosition:d+1})})))),t.add(o.toDisposable(s))}async replace(){return this._matchingModel?this._matchingModel.replace(this._state.replaceString):!1}async replaceAll(){const n=await Promise.all(this._findModels.map(t=>t.replaceAll(this._state.replaceString))).then(t=>t.reduce((s,a)=>(s.success+=a.success,s.failure+=a.failure,s),{success:0,failure:0}));return n.failure===0&&this._stopSearching(),n}getCurrentMatch(){return this._state.matchesPosition>0?this._matches[this._state.matchesPosition-1]:null}_markMatch(n){const t=this._matches.findIndex(s=>s===n);this.currentMatch$.next(n),this._state.changeState({matchesPosition:t+1})}moveToNextMatch(){if(!this._matchingModel)return;const n=this._findModels.length===1,t=this._matchingModel.moveToNextMatch({loop:n});if(t)return this._markMatch(t),t;{const s=this._findModels.findIndex(a=>a===this._matchingModel);return this._moveToNextUnitMatch(s)}}_moveToNextUnitMatch(n){const t=this._findModels.length;for(let s=(n+1)%t;s!==n;){const a=this._findModels[s],r=a.moveToNextMatch({ignoreSelection:!0});if(r)return this._matchingModel=a,this._markMatch(r),r;s=(s+1)%t}if(this._matchingModel){const s=this._matchingModel.moveToNextMatch({ignoreSelection:!0});return s&&this._markMatch(s),s}}moveToPreviousMatch(){if(!this._matchingModel)return;const n=this._findModels.length===1,t=this._matchingModel.moveToPreviousMatch({loop:n});if(t){const s=this._matches.findIndex(a=>a===t);return this.currentMatch$.next(t),this._state.changeState({matchesPosition:s+1}),t}else{const s=this._findModels.length,a=this._findModels.findIndex(d=>d===this._matchingModel);for(let d=(a-1+s)%s;d!==a;){const f=this._findModels[d],v=f.moveToPreviousMatch({ignoreSelection:!0});if(v)return this._matchingModel=f,this._markMatch(v),v;d=(d-1)%s}const r=this._matchingModel.moveToPreviousMatch({ignoreSelection:!0});return r&&this._markMatch(r),r}}_moveToInitialMatch(n,t=!1){var r;const s=(r=this._univerInstanceService.getFocusedUnit())==null?void 0:r.getUnitId();if(!s)return-1;const a=n.findIndex(d=>d.unitId===s);if(a!==-1){this._matchingModel=n[a];const d=this._matchingModel.moveToNextMatch({stayIfOnMatch:!0,noFocus:t});if(d)return this._markMatch(d),a}return this._moveToNextUnitMatch(a),0}},l.FindReplaceModel=q([P(2,o.IUniverInstanceService),P(3,o.ICommandService)],l.FindReplaceModel);var E=(i=>(i.ROW="row",i.COLUMN="column",i))(E||{}),O=(i=>(i.VALUE="value",i.FORMULA="formula",i))(O||{}),N=(i=>(i.SUBUNIT="subunit",i.UNIT="unit",i))(N||{});function $(){return{caseSensitive:!1,findBy:"value",findCompleted:!1,findDirection:"row",findScope:"subunit",findString:"",inputtingFindString:"",matchesCount:0,matchesPosition:0,matchesTheWholeCell:!1,replaceRevealed:!1,replaceString:"",revealed:!0}}class Z{constructor(){u(this,"_stateUpdates$",new m.Subject);u(this,"stateUpdates$",this._stateUpdates$.asObservable());u(this,"_state$",new m.BehaviorSubject($()));u(this,"state$",this._state$.asObservable());u(this,"_findString","");u(this,"_inputtingFindString","");u(this,"_replaceString","");u(this,"_revealed",!1);u(this,"_replaceRevealed",!1);u(this,"_matchesPosition",0);u(this,"_matchesCount",0);u(this,"_caseSensitive",!0);u(this,"_matchesTheWholeCell",!1);u(this,"_findDirection","row");u(this,"_findScope","subunit");u(this,"_findBy","value");u(this,"_findCompleted",!1)}get state(){return this._state$.getValue()}get inputtingFindString(){return this._inputtingFindString}get findString(){return this._findString}get revealed(){return this._revealed}get replaceRevealed(){return this._replaceRevealed}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get replaceString(){return this._replaceString}get caseSensitive(){return this._caseSensitive}get matchesTheWholeCell(){return this._matchesTheWholeCell}get findDirection(){return this._findDirection}get findScope(){return this._findScope}get findBy(){return this._findBy}get findCompleted(){return this._findCompleted}changeState(e){let n=!1;const t={};typeof e.findString<"u"&&e.findString!==this._findString&&(this._findString=e.findString,t.findString=this._findString,n=!0),typeof e.revealed<"u"&&e.revealed!==this._revealed&&(this._revealed=e.revealed,t.revealed=e.revealed,n=!0),typeof e.replaceRevealed<"u"&&e.replaceRevealed!==this._replaceRevealed&&(this._replaceRevealed=e.replaceRevealed,t.replaceRevealed=e.replaceRevealed,n=!0),typeof e.replaceString<"u"&&e.replaceString!==this._replaceString&&(this._replaceString=e.replaceString,t.replaceString=e.replaceString,n=!0),typeof e.matchesCount<"u"&&e.matchesCount!==this._matchesCount&&(this._matchesCount=e.matchesCount,t.matchesCount=e.matchesCount,n=!0),typeof e.matchesPosition<"u"&&e.matchesPosition!==this._matchesPosition&&(this._matchesPosition=e.matchesPosition,t.matchesPosition=e.matchesPosition,n=!0),typeof e.findBy<"u"&&e.findBy!==this._findBy&&(this._findBy=e.findBy,t.findBy=e.findBy,n=!0),typeof e.findScope<"u"&&e.findScope!==this._findScope&&(this._findScope=e.findScope,t.findScope=e.findScope,n=!0),typeof e.findDirection<"u"&&e.findDirection!==this._findDirection&&(this._findDirection=e.findDirection,t.findDirection=e.findDirection,n=!0),typeof e.caseSensitive<"u"&&e.caseSensitive!==this._caseSensitive&&(this._caseSensitive=e.caseSensitive,t.caseSensitive=e.caseSensitive,n=!0),typeof e.matchesTheWholeCell<"u"&&e.matchesTheWholeCell!==this._matchesTheWholeCell&&(this._matchesTheWholeCell=e.matchesTheWholeCell,t.matchesTheWholeCell=e.matchesTheWholeCell,n=!0),typeof e.inputtingFindString<"u"&&e.inputtingFindString!==this._inputtingFindString&&(this._inputtingFindString=e.inputtingFindString,t.inputtingFindString=e.inputtingFindString,n=!0),typeof e.findCompleted<"u"&&e.findCompleted!==this._findCompleted&&(this._findCompleted=e.findCompleted,t.findCompleted=e.findCompleted,n=!0),n&&(this._state$.next({caseSensitive:this._caseSensitive,findBy:this._findBy,findCompleted:this._findCompleted,findDirection:this._findDirection,findScope:this._findScope,findString:this._findString,inputtingFindString:this._inputtingFindString,matchesCount:this._matchesCount,matchesPosition:this._matchesPosition,matchesTheWholeCell:this._matchesTheWholeCell,replaceRevealed:this._replaceRevealed,revealed:this._revealed}),this._stateUpdates$.next(t))}}let A=class extends o.Disposable{constructor(e,n){super();u(this,"_providers",new Set);u(this,"_state",new Z);u(this,"_model");u(this,"_currentMatch$",new m.BehaviorSubject(null));u(this,"currentMatch$",this._currentMatch$.asObservable());u(this,"_replaceables$",new m.BehaviorSubject([]));u(this,"replaceables$",this._replaceables$.asObservable());u(this,"_focusSignal$",new m.Subject);u(this,"focusSignal$",this._focusSignal$.asObservable());this._injector=e,this._contextService=n}get stateUpdates$(){return this._state.stateUpdates$}get state$(){return this._state.state$}get revealed(){return this._state.revealed}get replaceRevealed(){return this._state.replaceRevealed}dispose(){super.dispose(),this._currentMatch$.next(null),this._currentMatch$.complete(),this._replaceables$.next([]),this._replaceables$.complete(),this._focusSignal$.complete()}getProviders(){return this._providers}getCurrentMatch(){var e;return(e=this._model)==null?void 0:e.getCurrentMatch()}getFindString(){return this._state.findString}changeFindString(e){this._state.changeState({findString:e})}focusFindInput(){this._focusSignal$.next()}changeInputtingFindString(e){e?this._state.changeState({inputtingFindString:e}):this._state.changeState({inputtingFindString:"",findString:""})}changeReplaceString(e){this._state.changeState({replaceString:e})}changeMatchesTheWholeCell(e){this._state.changeState({matchesTheWholeCell:e})}changeCaseSensitive(e){this._state.changeState({caseSensitive:e})}changeFindBy(e){this._state.changeState({findBy:e}),this._toggleDisplayRawFormula(e==="formula")}changeFindScope(e){this._state.changeState({findScope:e})}changeFindDirection(e){this._state.changeState({findDirection:e})}moveToNextMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToNextMatch(),this._focusSignal$.next())}moveToPreviousMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToPreviousMatch(),this._focusSignal$.next())}async replace(){return this._model?this._model.replace():!1}async replaceAll(){if(!this._model)throw new Error("[FindReplaceService] replaceAll: model is not initialized!");return this._model.replaceAll()}revealReplace(){this._state.changeState({replaceRevealed:!0,inputtingFindString:this._state.findString}),this._toggleRevealReplace(!0)}focusSelection(){var e;(e=this._model)==null||e.focusSelection()}start(e=!1){if(this._providers.size===0)return!1;this._model=this._injector.createInstance(l.FindReplaceModel,this._state,this._providers),this._model.currentMatch$.subscribe(t=>this._currentMatch$.next(t)),this._model.replaceables$.subscribe(t=>this._replaceables$.next(t));const n=$();return e&&(n.replaceRevealed=!0),this._state.changeState(n),this._toggleRevealReplace(e),!0}find(){var e;(e=this._model)==null||e.start()}terminate(){var e;(e=this._model)==null||e.dispose(),this._model=null,this._toggleDisplayRawFormula(!1),this._toggleRevealReplace(!1)}registerFindReplaceProvider(e){return this._providers.add(e),o.toDisposable(()=>this._providers.delete(e))}_toggleRevealReplace(e){this._contextService.setContextValue(H,e)}_toggleDisplayRawFormula(e){this._contextService.setContextValue(re.RENDER_RAW_FORMULA_KEY,e)}};A=q([P(0,o.Inject(o.Injector)),P(1,o.IContextService)],A);const U={id:"ui.command.replace-current-match",type:o.CommandType.COMMAND,handler:i=>i.get(S).replace()},de="CONFIRM_REPLACE_ALL",x={id:"ui.command.replace-all-matches",type:o.CommandType.COMMAND,handler:async i=>{const e=i.get(c.IConfirmService),n=i.get(o.LocaleService),t=i.get(c.IMessageService);if(!await e.confirm({id:de,title:{title:n.t("find-replace.replace.confirm.title")},cancelText:n.t("button.cancel"),confirmText:n.t("button.confirm")}))return!1;const a=await i.get(S).replaceAll(),{success:r,failure:d}=a;return d>0?(r===0?t.show({type:_.MessageType.Error,content:n.t("find-replace.replace.all-failure")}):t.show({type:_.MessageType.Warning,content:n.t("find-replace.replace.partial-success",`${r}`,`${d}`)}),!1):(t.show({type:_.MessageType.Success,content:n.t("find-replace.replace.all-success",`${r}`)}),!0)}},I={id:"ui.operation.open-find-dialog",type:o.CommandType.OPERATION,handler:i=>{const e=i.get(S);return e.revealed?e.focusFindInput():e.start(),!0}},L={id:"ui.operation.open-replace-dialog",type:o.CommandType.OPERATION,handler:i=>{const e=i.get(S);return e.revealed?e.replaceRevealed?e.focusFindInput():e.revealReplace():e.start(!0),!0}},w={type:o.CommandType.OPERATION,id:"ui.operation.go-to-next-match",handler:i=>(i.get(S).moveToNextMatch(),!0)},k={type:o.CommandType.OPERATION,id:"ui.operation.go-to-previous-match",handler:i=>(i.get(S).moveToPreviousMatch(),!0)},z={type:o.CommandType.OPERATION,id:"ui.operation.focus-selection",handler:i=>(i.get(S).focusSelection(),!0)};function Y({ref:i,...e}){const{icon:n,id:t,className:s,extend:a,...r}=e,d=`univerjs-icon univerjs-icon-${t} ${s||""}`.trim(),f=p.useRef(`_${pe()}`);return J(n,`${t}`,{defIds:n.defIds,idSuffix:f.current},{ref:i,className:d,...r},a)}function J(i,e,n,t,s){return p.createElement(i.tag,{key:e,...he(i,n,s),...t},(ue(i,n).children||[]).map((a,r)=>J(a,`${e}-${i.tag}-${r}`,n,void 0,s)))}function he(i,e,n){const t={...i.attrs};n!=null&&n.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=n.colorChannel1),i.tag==="mask"&&t.id&&(t.id=t.id+e.idSuffix),Object.entries(t).forEach(([a,r])=>{a==="mask"&&typeof r=="string"&&(t[a]=r.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))});const{defIds:s}=e;return!s||s.length===0||(i.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+e.idSuffix),Object.entries(t).forEach(([a,r])=>{typeof r=="string"&&(t[a]=r.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))})),t}function ue(i,e){var t;const{defIds:n}=e;return!n||n.length===0?i:i.tag==="defs"&&((t=i.children)!=null&&t.length)?{...i,children:i.children.map(s=>typeof s.attrs.id=="string"&&n&&n.includes(s.attrs.id)?{...s,attrs:{...s.attrs,id:s.attrs.id+e.idSuffix}}:s)}:i}function pe(){return Math.random().toString(36).substring(2,8)}Y.displayName="UniverIcon";const fe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.71899 1.36938C4.37604 1.36938 1.66602 4.07941 1.66602 7.42236C1.66602 10.7653 4.37604 13.4753 7.71899 13.4753C9.16744 13.4753 10.4971 12.9666 11.5389 12.118L13.6598 14.4109C13.8848 14.6542 14.2644 14.669 14.5077 14.444C14.7509 14.219 14.7657 13.8393 14.5407 13.5961L12.3906 11.2716C13.2536 10.2254 13.772 8.88442 13.772 7.42236C13.772 4.07941 11.0619 1.36938 7.71899 1.36938ZM2.86602 7.42236C2.86602 4.74215 5.03878 2.56938 7.71899 2.56938C10.3992 2.56938 12.572 4.74215 12.572 7.42236C12.572 10.1026 10.3992 12.2753 7.71899 12.2753C5.03878 12.2753 2.86602 10.1026 2.86602 7.42236Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Q=p.forwardRef(function(e,n){return p.createElement(Y,Object.assign({},e,{id:"search-icon",ref:n,icon:fe}))});Q.displayName="SearchIcon";function X(i){const{findCompleted:e,localeService:n,matchesCount:t,matchesPosition:s,initialFindString:a,findReplaceService:r,onChange:d,...f}=i,[v,C]=p.useState(a),D=e&&t===0?n.t("find-replace.dialog.no-result"):t===0?" ":void 0;function y(M){s===t&&M===1?r.moveToNextMatch():s===1&&M===t||M<s?r.moveToPreviousMatch():r.moveToNextMatch()}return h.jsx("div",{className:"univer-relative univer-flex univer-items-center univer-gap-2",onDrag:M=>M.stopPropagation(),children:h.jsx(_.Input,{"data-u-comp":"search-input",autoFocus:!0,placeholder:n.t("find-replace.dialog.find-placeholder"),value:v,onChange:M=>{C(M),d==null||d(M)},slot:h.jsx(_.Pager,{loop:!0,text:D,value:s,total:t,onChange:y}),...f})})}function ee(i,e){const n=p.useCallback(()=>{var s;(s=document.querySelector(".univer-find-input input"))==null||s.focus()},[]),t=p.useCallback(()=>{const s=document.querySelectorAll("[data-u-comp=find-replace-dialog] [data-u-comp=search-input]");return Array.from(s).some(a=>a===document.activeElement)},[]);return p.useImperativeHandle(e,()=>({focus:n,selectHasFocus:t})),p.useEffect(()=>{const s=i.focusSignal$.subscribe(()=>n());return()=>s.unsubscribe()},[i,n]),{focus:n,selectHasFocus:t}}const _e=p.forwardRef(function(e,n){const t=c.useDependency(o.LocaleService),s=c.useDependency(S),a=c.useDependency(o.ICommandService),r=c.useObservable(s.state$,void 0,!0),{findCompleted:d,findString:f,matchesCount:v,matchesPosition:C}=r,F=p.useCallback(()=>{a.executeCommand(L.id)},[a]),D=c.useDebounceFn(y=>s.changeFindString(y),500);return ee(s,n),h.jsxs(h.Fragment,{children:[h.jsx(X,{findCompleted:d,matchesCount:v,matchesPosition:C,findReplaceService:s,localeService:t,initialFindString:f,onChange:D}),h.jsx("div",{className:"univer-mt-4 univer-text-center",children:h.jsx("a",{className:"hover:univer-text-primary-500/80 univer-cursor-pointer univer-text-sm univer-text-primary-500 univer-transition-colors",onClick:F,children:t.t("find-replace.dialog.advanced-finding")})})]})}),ge=p.forwardRef(function(e,n){const t=c.useDependency(S),s=c.useDependency(o.LocaleService),a=c.useDependency(o.ICommandService),r=c.useDependency(c.IMessageService),d=c.useObservable(t.currentMatch$,void 0,!0),f=c.useObservable(t.replaceables$,void 0,!0),v=c.useObservable(t.state$,void 0,!0),{matchesCount:C,matchesPosition:F,findString:D,inputtingFindString:y,replaceString:M,caseSensitive:ke,matchesTheWholeCell:Be,findDirection:We,findScope:je,findBy:Ge,findCompleted:G}=v,Ve=y.length===0,Ke=C===0||!(d!=null&&d.replaceable),He=f.length===0,qe=p.useCallback(g=>t.changeInputtingFindString(g),[t]),Ze=p.useCallback(g=>t.changeReplaceString(g),[t]),{focus:ze}=ee(t,n),Ye=p.useCallback(()=>{D===y?t.moveToNextMatch():(t.changeFindString(y),t.find())},[D,y,t]),Je=p.useCallback(()=>a.executeCommand(U.id),[a]),Qe=p.useCallback(async()=>{await a.executeCommand(x.id),ze()},[a]),Xe=p.useCallback(g=>{t.changeFindDirection(g)},[t]),et=p.useCallback(g=>{t.changeFindScope(g)},[t]),tt=p.useCallback(g=>{t.changeFindBy(g)},[t]),it=ve(s),nt=Se(s),st=Ce(s);return p.useEffect(()=>{G&&C===0&&r.show({content:s.t("find-replace.dialog.no-match"),type:_.MessageType.Warning,duration:5e3})},[G,C,r,s]),h.jsxs("div",{children:[h.jsx(_.FormLayout,{label:s.t("find-replace.dialog.find"),children:h.jsx(X,{findCompleted:G,className:"univer-find-input",matchesCount:C,matchesPosition:F,findReplaceService:t,localeService:s,initialFindString:y,onChange:qe})}),h.jsx(_.FormLayout,{label:s.t("find-replace.dialog.replace"),children:h.jsx(_.Input,{placeholder:s.t("find-replace.dialog.replace-placeholder"),value:M,onChange:g=>Ze(g)})}),h.jsx(_.FormLayout,{label:s.t("find-replace.dialog.find-direction.title"),children:h.jsx(_.Select,{value:We,options:nt,onChange:Xe})}),h.jsx(_.FormDualColumnLayout,{children:h.jsxs(h.Fragment,{children:[h.jsx(_.FormLayout,{label:s.t("find-replace.dialog.find-scope.title"),children:h.jsx(_.Select,{value:je,options:it,onChange:et})}),h.jsx(_.FormLayout,{label:s.t("find-replace.dialog.find-by.title"),children:h.jsx(_.Select,{value:Ge,options:st,onChange:tt})})]})}),h.jsx(_.FormDualColumnLayout,{children:h.jsxs(h.Fragment,{children:[h.jsx(_.FormLayout,{children:h.jsx(_.Checkbox,{checked:ke,onChange:g=>{t.changeCaseSensitive(g)},children:s.t("find-replace.dialog.case-sensitive")})}),h.jsx(_.FormLayout,{children:h.jsx(_.Checkbox,{checked:Be,onChange:g=>{t.changeMatchesTheWholeCell(g)},children:s.t("find-replace.dialog.match-the-whole-cell")})})]})}),h.jsxs("div",{className:"univer-mt-6 univer-flex univer-justify-between",children:[h.jsx(_.Button,{variant:"primary",onClick:Ye,disabled:Ve,children:s.t("find-replace.dialog.find")}),h.jsxs("span",{className:"univer-inline-flex univer-gap-2",children:[h.jsx(_.Button,{disabled:Ke,onClick:Je,children:s.t("find-replace.dialog.replace")}),h.jsx(_.Button,{disabled:He,onClick:Qe,children:s.t("find-replace.dialog.replace-all")})]})]})]})});function me(){const i=c.useDependency(S),e=c.useDependency(c.ILayoutService),n=c.useDependency(o.IContextService),t=c.useObservable(i.state$,void 0,!0),s=p.useRef(null);p.useEffect(()=>{let f;return s.current&&(f=e.registerContainerElement(s.current)),()=>f==null?void 0:f.dispose()},[e]);const a=p.useRef(null),r=p.useCallback(f=>n.setContextValue(K,f),[n]),d=p.useCallback(f=>n.setContextValue(V,f),[n]);return p.useEffect(()=>{var v;const f=m.fromEvent(document,"focusin").subscribe(C=>{var F;C.target&&((F=s.current)!=null&&F.contains(C.target))?r(!0):r(!1),!a.current||!a.current.selectHasFocus()?d(!1):d(!0)});return(v=a.current)==null||v.focus(),r(!0),d(!0),()=>{f.unsubscribe(),r(!1)}},[r,d]),h.jsx("div",{ref:s,"data-u-comp":"find-replace-dialog",children:t.replaceRevealed?h.jsx(ge,{ref:a}):h.jsx(_e,{ref:a})})}function ve(i){const e=i.getCurrentLocale();return p.useMemo(()=>[{label:i.t("find-replace.dialog.find-scope.current-sheet"),value:N.SUBUNIT},{label:i.t("find-replace.dialog.find-scope.workbook"),value:N.UNIT}],[e])}function Se(i){const e=i.getCurrentLocale();return p.useMemo(()=>[{label:i.t("find-replace.dialog.find-direction.row"),value:E.ROW},{label:i.t("find-replace.dialog.find-direction.column"),value:E.COLUMN}],[e])}function Ce(i){const e=i.getCurrentLocale();return p.useMemo(()=>[{label:i.t("find-replace.dialog.find-by.value"),value:O.VALUE},{label:i.t("find-replace.dialog.find-by.formula"),value:O.FORMULA}],[e])}function R(i){return i.getContextValue(K)}function Me(i){return i.getContextValue(H)}function te(i){return i.getContextValue(V)}const T="7_find-replace-shortcuts";function B(i){return i.getContextValue(o.FOCUSING_SHEET)}function W(i){return!i.getContextValue(o.EDITOR_ACTIVATED)}const be={id:I.id,description:"find-replace.shortcut.open-find-dialog",binding:c.KeyCode.F|c.MetaKeys.CTRL_COMMAND,group:T,preconditions(i){return!R(i)&&B(i)&&W(i)}},ye={id:I.id,description:"find-replace.shortcut.open-find-dialog",binding:c.KeyCode.F|c.MetaKeys.CTRL_COMMAND,mac:c.KeyCode.F|c.MetaKeys.MAC_CTRL,preconditions(i){return!R(i)&&B(i)&&W(i)}},Fe={id:L.id,description:"find-replace.shortcut.open-replace-dialog",binding:c.KeyCode.H|c.MetaKeys.CTRL_COMMAND,mac:c.KeyCode.H|c.MetaKeys.MAC_CTRL,group:T,preconditions(i){return B(i)&&W(i)&&(!R(i)||!Me(i))}},Ie={id:w.id,description:"find-replace.shortcut.go-to-next-match",binding:c.KeyCode.ENTER,group:T,priority:1e3,preconditions(i){return te(i)&&R(i)}},Re={id:k.id,description:"find-replace.shortcut.go-to-previous-match",binding:c.KeyCode.ENTER|c.MetaKeys.SHIFT,group:T,priority:1e3,preconditions(i){return te(i)&&R(i)}},De={id:z.id,description:"find-replace.shortcut.focus-selection",binding:c.KeyCode.ESC,group:T,priority:1e3,preconditions(i){return R(i)}};function Te(i){const e=i.get(o.IContextService);return{id:I.id,icon:"SearchIcon",tooltip:"find-replace.toolbar",type:c.MenuItemType.BUTTON,hidden$:c.getMenuHiddenObservable(i,o.UniverInstanceType.UNIVER_SHEET),disabled$:m.combineLatest([e.subscribeContextValue$(o.EDITOR_ACTIVATED),e.subscribeContextValue$(o.FOCUSING_SHEET)]).pipe(m.map(([n,t])=>n||!t))}}const Pe={[c.RibbonDataGroup.ORGANIZATION]:{[I.id]:{order:2,menuItemFactory:Te}}};var Ee=Object.getOwnPropertyDescriptor,Oe=(i,e,n,t)=>{for(var s=t>1?void 0:t?Ee(e,n):e,a=i.length-1,r;a>=0;a--)(r=i[a])&&(s=r(s)||s);return s},b=(i,e)=>(n,t)=>e(n,t,i);const ie="DESKTOP_FIND_REPLACE_DIALOG",ne=350,Ne=20,$e=64;l.FindReplaceController=class extends o.RxDisposable{constructor(n,t,s,a,r,d,f,v,C){super();u(this,"_closingListenerDisposable");this._univerInstanceService=n,this._menuManagerService=t,this._shortcutService=s,this._commandService=a,this._findReplaceService=r,this._dialogService=d,this._layoutService=f,this._localeService=v,this._componentManager=C,this._initCommands(),this._initUI(),this._initShortcuts()}dispose(){var n;super.dispose(),(n=this._closingListenerDisposable)==null||n.dispose(),this._closingListenerDisposable=null}_initCommands(){[I,L,w,k,x,U,z].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initShortcuts(){[Fe,be,ye,Re,Ie,De].forEach(n=>this.disposeWithMe(this._shortcutService.registerShortcut(n)))}_initUI(){[["FindReplaceDialog",me],["SearchIcon",Q]].forEach(([n,t])=>{this.disposeWithMe(this._componentManager.register(n,t))}),this._menuManagerService.mergeMenu(Pe),this._findReplaceService.stateUpdates$.pipe(m.takeUntil(this.dispose$)).subscribe(n=>{n.revealed===!0&&this._openPanel()})}_openPanel(){this._dialogService.open({id:ie,draggable:!0,width:ne,title:{title:this._localeService.t("find-replace.dialog.title")},children:{label:"FindReplaceDialog"},destroyOnClose:!0,mask:!1,maskClosable:!1,defaultPosition:Le(),preservePositionOnDestroy:!0,onClose:()=>this.closePanel()}),this._closingListenerDisposable=o.toDisposable(this._univerInstanceService.focused$.pipe(m.takeUntil(this.dispose$)).subscribe(n=>{(!n||!this._univerInstanceService.getUniverSheetInstance(n))&&this.closePanel()}))}closePanel(){this._closingListenerDisposable&&(this._closingListenerDisposable.dispose(),this._closingListenerDisposable=null,this._dialogService.close(ie),this._findReplaceService.terminate(),queueMicrotask(()=>this._layoutService.focus()))}},l.FindReplaceController=Oe([b(0,o.IUniverInstanceService),b(1,c.IMenuManagerService),b(2,c.IShortcutService),b(3,o.ICommandService),b(4,S),b(5,c.IDialogService),b(6,c.ILayoutService),b(7,o.Inject(o.LocaleService)),b(8,o.Inject(c.ComponentManager))],l.FindReplaceController);function Le(){const{innerWidth:i}=window;return{x:i-ne-Ne,y:$e}}const Ae="find-replace.config",se={};var Ue=Object.getOwnPropertyDescriptor,xe=(i,e,n,t)=>{for(var s=t>1?void 0:t?Ue(e,n):e,a=i.length-1,r;a>=0;a--)(r=i[a])&&(s=r(s)||s);return s},ae=(i,e)=>(n,t)=>e(n,t,i);const we="UNIVER_FIND_REPLACE_PLUGIN";l.UniverFindReplacePlugin=(j=class extends o.Plugin{constructor(e=se,n,t){super(),this._config=e,this._injector=n,this._configService=t;const{...s}=o.merge({},se,this._config);this._configService.setConfig(Ae,s)}onStarting(){[[l.FindReplaceController],[S,{useClass:A}]].forEach(e=>this._injector.add(e))}onRendered(){this._injector.get(l.FindReplaceController)}},u(j,"pluginName",we),j),l.UniverFindReplacePlugin=xe([ae(1,o.Inject(o.Injector)),ae(2,o.IConfigService)],l.UniverFindReplacePlugin),l.FindBy=O,l.FindDirection=E,l.FindModel=ce,l.FindReplaceState=Z,l.FindScope=N,l.GoToNextMatchOperation=w,l.GoToPreviousMatchOperation=k,l.IFindReplaceService=S,l.OpenFindDialogOperation=I,l.OpenReplaceDialogOperation=L,l.ReplaceAllMatchesCommand=x,l.ReplaceCurrentMatchCommand=U,l.createInitFindReplaceState=$,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
3
3
 
4
4
 
5
5
  // @univerjs/sheets-find-replace/index
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/preset-sheets-find-replace",
3
- "version": "0.10.12-nightly.202510221114",
3
+ "version": "0.10.13",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum Co., Ltd. <developer@univer.ai>",
@@ -58,16 +58,16 @@
58
58
  "rxjs": ">=7.0.0"
59
59
  },
60
60
  "dependencies": {
61
- "@univerjs/find-replace": "0.10.12-nightly.202510221114",
62
- "@univerjs/sheets-find-replace": "0.10.12-nightly.202510221114"
61
+ "@univerjs/find-replace": "0.10.13",
62
+ "@univerjs/sheets-find-replace": "0.10.13"
63
63
  },
64
64
  "devDependencies": {
65
- "@univerjs/core": "0.10.12-nightly.202510221114",
65
+ "@univerjs/core": "0.10.13",
66
66
  "react": "18.3.1",
67
67
  "react-dom": "18.3.1",
68
68
  "rxjs": "7.8.2",
69
69
  "typescript": "^5.9.3",
70
- "@univerjs-infra/shared": "0.10.12"
70
+ "@univerjs-infra/shared": "0.10.13"
71
71
  },
72
72
  "scripts": {
73
73
  "prebuild:preset": "tsx prepare.ts",