@univerjs/find-replace 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var Fe=Object.defineProperty;var xe=(t,e,n)=>e in t?Fe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var u=(t,e,n)=>xe(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),l=require("@univerjs/ui"),_=require("rxjs"),f=require("@univerjs/design"),De=require("@univerjs/engine-render"),d=require("react/jsx-runtime"),h=require("react"),Te="find-replace.config",V={};var C=function(){return C=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},C.apply(this,arguments)},Oe=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]]);return n},q=h.forwardRef(function(t,e){var n=t.icon,i=t.id,s=t.className,r=t.extend,a=Oe(t,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(i," ").concat(s||"").trim(),p=h.useRef("_".concat(Ne()));return z(n,"".concat(i),{defIds:n.defIds,idSuffix:p.current},C({ref:e,className:c},a),r)});function z(t,e,n,i,s){return h.createElement(t.tag,C(C({key:e},Pe(t,n,s)),i),(Ee(t,n).children||[]).map(function(r,a){return z(r,"".concat(e,"-").concat(t.tag,"-").concat(a),n,void 0,s)}))}function Pe(t,e,n){var i=C({},t.attrs);n!=null&&n.colorChannel1&&i.fill==="colorChannel1"&&(i.fill=n.colorChannel1),t.tag==="mask"&&i.id&&(i.id=i.id+e.idSuffix),Object.entries(i).forEach(function(r){var a=r[0],c=r[1];a==="mask"&&typeof c=="string"&&(i[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var s=e.defIds;return!s||s.length===0||(t.tag==="use"&&i["xlink:href"]&&(i["xlink:href"]=i["xlink:href"]+e.idSuffix),Object.entries(i).forEach(function(r){var a=r[0],c=r[1];typeof c=="string"&&(i[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),i}function Ee(t,e){var n,i=e.defIds;return!i||i.length===0?t:t.tag==="defs"&&(!((n=t.children)===null||n===void 0)&&n.length)?C(C({},t),{children:t.children.map(function(s){return typeof s.attrs.id=="string"&&i&&i.indexOf(s.attrs.id)>-1?C(C({},s),{attrs:C(C({},s.attrs),{id:s.attrs.id+e.idSuffix})}):s})}):t}function Ne(){return Math.random().toString(36).substring(2,8)}q.displayName="UniverIcon";var Le={tag:"svg",attrs:{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"}}]},Y=h.forwardRef(function(t,e){return h.createElement(q,Object.assign({},t,{id:"search-single",ref:e,icon:Le}))});Y.displayName="SearchSingle";const Z="FIND_REPLACE_INPUT_FOCUS",J="FIND_REPLACE_DIALOG_FOCUS",Q="FIND_REPLACE_REPLACE_REVEALED";var $e=Object.getOwnPropertyDescriptor,X=(t,e,n,i)=>{for(var s=i>1?void 0:i?$e(e,n):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(s=a(s)||s);return s},j=(t,e)=>(n,i)=>e(n,i,t);class je extends o.Disposable{}const R=o.createIdentifier("find-replace.service");function Ae(t){return typeof t.findString<"u"||typeof t.inputtingFindString<"u"||typeof t.findDirection<"u"||typeof t.matchesTheWholeCell<"u"||typeof t.caseSensitive<"u"||typeof t.findScope<"u"||typeof t.findBy<"u"}exports.FindReplaceModel=class extends o.Disposable{constructor(n,i,s){super();u(this,"currentMatch$",new _.BehaviorSubject(null));u(this,"replaceables$",new _.BehaviorSubject([]));u(this,"_findModels",[]);u(this,"_matchingModel",null);u(this,"_matches",[]);u(this,"_currentSearchingDisposables",null);this._state=n,this._providers=i,this._univerInstanceService=s,this.disposeWithMe(this._state.stateUpdates$.pipe(_.throttleTime(200,void 0,{leading:!0,trailing:!0})).subscribe(async r=>{const a=this._state.state;Ae(r)&&(a.findString!==""&&!a.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({...P(),revealed:!1})}async start(){if(!this._state.findString)return{results:[]};const n=await this._startSearching();return this._state.changeState({findCompleted:!0}),n}async _startSearching(){if(!this._state.findString)return{results:[]};const n=Array.from(this._providers),i=this._findModels=(await Promise.all(n.map(r=>r.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(i);const s=this._matches=i.map(r=>r.getMatches()).flat();return this.replaceables$.next(s.filter(r=>r.replaceable)),s.length?(this._moveToInitialMatch(i),this._state.changeState({matchesCount:s.length}),{results:s}):(this._state.changeState({matchesCount:0,matchesPosition:0}),{results:[]})}_stopSearching(){var n;this._providers.forEach(i=>i.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 i=this._currentSearchingDisposables=new o.DisposableCollection,s=_.combineLatest(n.map(r=>r.matchesUpdate$)).pipe(_.debounceTime(220)).subscribe(([...r])=>{const a=this._matches=r.flat();a.length?(this._moveToInitialMatch(this._findModels,!0),this._state.changeState({matchesCount:a.length}),this.replaceables$.next(a.filter(c=>c.replaceable))):(this._state.changeState({matchesCount:0,matchesPosition:0}),this.replaceables$.next([]))});n.forEach(r=>i.add(o.toDisposable(r.activelyChangingMatch$.subscribe(a=>{const c=this._matches.findIndex(p=>p===a);this._state.changeState({matchesPosition:c+1})})))),i.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(i=>i.replaceAll(this._state.replaceString))).then(i=>i.reduce((s,r)=>(s.success+=r.success,s.failure+=r.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 i=this._matches.findIndex(s=>s===n);this.currentMatch$.next(n),this._state.changeState({matchesPosition:i+1})}moveToNextMatch(){if(!this._matchingModel)return;const n=this._findModels.length===1,i=this._matchingModel.moveToNextMatch({loop:n});if(i)return this._markMatch(i),i;{const s=this._findModels.findIndex(r=>r===this._matchingModel);return this._moveToNextUnitMatch(s)}}_moveToNextUnitMatch(n){const i=this._findModels.length;for(let s=(n+1)%i;s!==n;){const r=this._findModels[s],a=r.moveToNextMatch({ignoreSelection:!0});if(a)return this._matchingModel=r,this._markMatch(a),a;s=(s+1)%i}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,i=this._matchingModel.moveToPreviousMatch({loop:n});if(i){const s=this._matches.findIndex(r=>r===i);return this.currentMatch$.next(i),this._state.changeState({matchesPosition:s+1}),i}else{const s=this._findModels.length,r=this._findModels.findIndex(c=>c===this._matchingModel);for(let c=(r-1+s)%s;c!==r;){const p=this._findModels[c],v=p.moveToPreviousMatch({ignoreSelection:!0});if(v)return this._matchingModel=p,this._markMatch(v),v;c=(c-1)%s}const a=this._matchingModel.moveToPreviousMatch({ignoreSelection:!0});return a&&this._markMatch(a),a}}_moveToInitialMatch(n,i=!1){var a;const s=(a=this._univerInstanceService.getFocusedUnit())==null?void 0:a.getUnitId();if(!s)return-1;const r=n.findIndex(c=>c.unitId===s);if(r!==-1){this._matchingModel=n[r];const c=this._matchingModel.moveToNextMatch({stayIfOnMatch:!0,noFocus:i});if(c)return this._markMatch(c),r}return this._moveToNextUnitMatch(r),0}};exports.FindReplaceModel=X([j(2,o.IUniverInstanceService)],exports.FindReplaceModel);var x=(t=>(t.ROW="row",t.COLUMN="column",t))(x||{}),D=(t=>(t.VALUE="value",t.FORMULA="formula",t))(D||{}),T=(t=>(t.SUBUNIT="subunit",t.UNIT="unit",t))(T||{});function P(){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 ee{constructor(){u(this,"_stateUpdates$",new _.Subject);u(this,"stateUpdates$",this._stateUpdates$.asObservable());u(this,"_state$",new _.BehaviorSubject(P()));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 i={};typeof e.findString<"u"&&e.findString!==this._findString&&(this._findString=e.findString,i.findString=this._findString,n=!0),typeof e.revealed<"u"&&e.revealed!==this._revealed&&(this._revealed=e.revealed,i.revealed=e.revealed,n=!0),typeof e.replaceRevealed<"u"&&e.replaceRevealed!==this._replaceRevealed&&(this._replaceRevealed=e.replaceRevealed,i.replaceRevealed=e.replaceRevealed,n=!0),typeof e.replaceString<"u"&&e.replaceString!==this._replaceString&&(this._replaceString=e.replaceString,i.replaceString=e.replaceString,n=!0),typeof e.matchesCount<"u"&&e.matchesCount!==this._matchesCount&&(this._matchesCount=e.matchesCount,i.matchesCount=e.matchesCount,n=!0),typeof e.matchesPosition<"u"&&e.matchesPosition!==this._matchesPosition&&(this._matchesPosition=e.matchesPosition,i.matchesPosition=e.matchesPosition,n=!0),typeof e.findBy<"u"&&e.findBy!==this._findBy&&(this._findBy=e.findBy,i.findBy=e.findBy,n=!0),typeof e.findScope<"u"&&e.findScope!==this._findScope&&(this._findScope=e.findScope,i.findScope=e.findScope,n=!0),typeof e.findDirection<"u"&&e.findDirection!==this._findDirection&&(this._findDirection=e.findDirection,i.findDirection=e.findDirection,n=!0),typeof e.caseSensitive<"u"&&e.caseSensitive!==this._caseSensitive&&(this._caseSensitive=e.caseSensitive,i.caseSensitive=e.caseSensitive,n=!0),typeof e.matchesTheWholeCell<"u"&&e.matchesTheWholeCell!==this._matchesTheWholeCell&&(this._matchesTheWholeCell=e.matchesTheWholeCell,i.matchesTheWholeCell=e.matchesTheWholeCell,n=!0),typeof e.inputtingFindString<"u"&&e.inputtingFindString!==this._inputtingFindString&&(this._inputtingFindString=e.inputtingFindString,i.inputtingFindString=e.inputtingFindString,n=!0),typeof e.findCompleted<"u"&&e.findCompleted!==this._findCompleted&&(this._findCompleted=e.findCompleted,i.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(i))}}let A=class extends o.Disposable{constructor(e,n){super();u(this,"_providers",new Set);u(this,"_state",new ee);u(this,"_model");u(this,"_currentMatch$",new _.BehaviorSubject(null));u(this,"currentMatch$",this._currentMatch$.asObservable());u(this,"_replaceables$",new _.BehaviorSubject([]));u(this,"replaceables$",this._replaceables$.asObservable());u(this,"_focusSignal$",new _.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)}start(e=!1){if(this._providers.size===0)return!1;this._model=this._injector.createInstance(exports.FindReplaceModel,this._state,this._providers),this._model.currentMatch$.subscribe(i=>this._currentMatch$.next(i)),this._model.replaceables$.subscribe(i=>this._replaceables$.next(i));const n=P();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(De.RENDER_RAW_FORMULA_KEY,e)}};A=X([j(0,o.Inject(o.Injector)),j(1,o.IContextService)],A);const w={id:"ui.command.replace-current-match",type:o.CommandType.COMMAND,handler:t=>t.get(R).replace()},we="CONFIRM_REPLACE_ALL",U={id:"ui.command.replace-all-matches",type:o.CommandType.COMMAND,handler:async t=>{const e=t.get(l.IConfirmService),n=t.get(o.LocaleService),i=t.get(l.IMessageService);if(!await e.confirm({id:we,title:{title:n.t("find-replace.replace.confirm.title")},cancelText:n.t("button.cancel"),confirmText:n.t("button.confirm")}))return!1;const r=await t.get(R).replaceAll(),{success:a,failure:c}=r;return c>0?(a===0?i.show({type:f.MessageType.Error,content:n.t("find-replace.replace.all-failure")}):i.show({type:f.MessageType.Warning,content:n.t("find-replace.replace.partial-success",`${a}`,`${c}`)}),!1):(i.show({type:f.MessageType.Success,content:n.t("find-replace.replace.all-success",`${a}`)}),!0)}},y={id:"ui.operation.open-find-dialog",type:o.CommandType.OPERATION,handler:t=>{const e=t.get(R);return e.revealed?e.focusFindInput():e.start(),!0}},E={id:"ui.operation.open-replace-dialog",type:o.CommandType.OPERATION,handler:t=>{const e=t.get(R);return e.revealed?e.replaceRevealed?e.focusFindInput():e.revealReplace():e.start(!0),!0}},B={type:o.CommandType.OPERATION,id:"ui.operation.go-to-next-match",handler:t=>(t.get(R).moveToNextMatch(),!0)},k={type:o.CommandType.OPERATION,id:"ui.operation.go-to-previous-match",handler:t=>(t.get(R).moveToPreviousMatch(),!0)},Ue="univer-find-replace-dialog-container",Be="univer-find-replace-expand-container",ke="univer-find-replace-buttons-group",We="univer-find-replace-buttons-group-right",O={findReplaceDialogContainer:Ue,findReplaceExpandContainer:Be,findReplaceButtonsGroup:ke,findReplaceButtonsGroupRight:We};function te(t){const{findCompleted:e,localeService:n,matchesCount:i,matchesPosition:s,findString:r,findReplaceService:a,onChange:c,...p}=t,S=e&&i===0?n.t("find-replace.dialog.no-result"):i===0?" ":void 0;return d.jsx(f.InputWithSlot,{autoFocus:!0,placeholder:n.t("find-replace.dialog.find-placeholder"),slot:d.jsx(f.Pager,{loop:!0,text:S,value:s,total:i,onChange:m=>{s===i&&m===1?a.moveToNextMatch():s===1&&m===i||m<s?a.moveToPreviousMatch():a.moveToNextMatch()}}),value:r,onChange:m=>c==null?void 0:c(m),...p})}function ie(t,e){const n=h.useCallback(()=>{var s;(s=document.querySelector(".univer-find-input input"))==null||s.focus()},[]),i=h.useCallback(()=>{const s=document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");return Array.from(s).some(r=>r===document.activeElement)},[]);return h.useImperativeHandle(e,()=>({focus:n,selectHasFocus:i})),h.useEffect(()=>{const s=t.focusSignal$.subscribe(()=>n());return()=>s.unsubscribe()},[t,n]),{focus:n,selectHasFocus:i}}const Ge=h.forwardRef(function(e,n){const i=l.useDependency(o.LocaleService),s=l.useDependency(R),r=l.useDependency(o.ICommandService),a=l.useObservable(s.state$,void 0,!0),{findCompleted:c,findString:p,matchesCount:v,matchesPosition:S}=a,m=h.useCallback(()=>{r.executeCommand(E.id)},[r]),F=h.useCallback(M=>s.changeFindString(M),[s]);return ie(s,n),d.jsxs(d.Fragment,{children:[d.jsx(te,{findCompleted:c,className:"univer-find-input",matchesCount:v,matchesPosition:S,findReplaceService:s,localeService:i,findString:p,onChange:F}),d.jsx("div",{className:O.findReplaceExpandContainer,children:d.jsx(f.Button,{type:"text",size:"small",onClick:m,children:i.t("find-replace.dialog.advanced-finding")})})]})}),Ve=h.forwardRef(function(e,n){const i=l.useDependency(R),s=l.useDependency(o.LocaleService),r=l.useDependency(o.ICommandService),a=l.useDependency(l.IMessageService),c=l.useObservable(i.currentMatch$,void 0,!0),p=l.useObservable(i.replaceables$,void 0,!0),v=l.useObservable(i.state$,void 0,!0),{matchesCount:S,matchesPosition:m,findString:F,inputtingFindString:M,replaceString:re,caseSensitive:ae,matchesTheWholeCell:oe,findDirection:ce,findScope:le,findBy:de,findCompleted:L}=v,ue=M.length===0,he=S===0||!(c!=null&&c.replaceable),pe=p.length===0,fe=h.useCallback(g=>i.changeInputtingFindString(g),[i]),ge=h.useCallback(g=>i.changeReplaceString(g),[i]),{focus:_e}=ie(i,n),me=h.useCallback(()=>{F===M?i.moveToNextMatch():(i.changeFindString(M),i.find())},[F,M,i]),ve=h.useCallback(()=>r.executeCommand(w.id),[r]),Se=h.useCallback(async()=>{await r.executeCommand(U.id),_e()},[r]),Ce=h.useCallback(g=>{i.changeFindDirection(g)},[i]),Re=h.useCallback(g=>{i.changeFindScope(g)},[i]),be=h.useCallback(g=>{i.changeFindBy(g)},[i]),Me=He(s),ye=qe(s),Ie=ze(s);return h.useEffect(()=>{L&&S===0&&a.show({content:s.t("find-replace.dialog.no-match"),type:f.MessageType.Warning,duration:5e3})},[L,S,a,s]),d.jsxs(d.Fragment,{children:[d.jsx(f.FormLayout,{label:s.t("find-replace.dialog.find"),children:d.jsx(te,{findCompleted:L,className:"univer-find-input",matchesCount:S,matchesPosition:m,findReplaceService:i,localeService:s,findString:M,onChange:fe})}),d.jsx(f.FormLayout,{label:s.t("find-replace.dialog.replace"),children:d.jsx(f.Input,{placeholder:s.t("find-replace.dialog.replace-placeholder"),value:re,onChange:g=>ge(g)})}),d.jsx(f.FormLayout,{label:s.t("find-replace.dialog.find-direction.title"),children:d.jsx(f.Select,{value:ce,options:ye,onChange:Ce})}),d.jsx(f.FormDualColumnLayout,{children:d.jsxs(d.Fragment,{children:[d.jsx(f.FormLayout,{label:s.t("find-replace.dialog.find-scope.title"),children:d.jsx(f.Select,{value:le,options:Me,onChange:Re})}),d.jsx(f.FormLayout,{label:s.t("find-replace.dialog.find-by.title"),children:d.jsx(f.Select,{value:de,options:Ie,onChange:be})})]})}),d.jsx(f.FormDualColumnLayout,{children:d.jsxs(d.Fragment,{children:[d.jsx(f.FormLayout,{children:d.jsx(f.Checkbox,{checked:ae,onChange:g=>{i.changeCaseSensitive(g)},children:s.t("find-replace.dialog.case-sensitive")})}),d.jsx(f.FormLayout,{children:d.jsx(f.Checkbox,{checked:oe,onChange:g=>{i.changeMatchesTheWholeCell(g)},children:s.t("find-replace.dialog.match-the-whole-cell")})})]})}),d.jsxs("div",{className:O.findReplaceButtonsGroup,children:[d.jsx(f.Button,{type:"primary",onClick:me,disabled:ue,children:s.t("find-replace.dialog.find")}),d.jsxs("span",{className:O.findReplaceButtonsGroupRight,children:[d.jsx(f.Button,{disabled:he,onClick:ve,children:s.t("find-replace.dialog.replace")}),d.jsx(f.Button,{disabled:pe,onClick:Se,children:s.t("find-replace.dialog.replace-all")})]})]})]})});function Ke(){const t=l.useDependency(R),e=l.useDependency(l.ILayoutService),n=l.useDependency(o.IContextService),i=l.useObservable(t.state$,void 0,!0),s=h.useRef(null);h.useEffect(()=>{let p;return s.current&&(p=e.registerContainerElement(s.current)),()=>p==null?void 0:p.dispose()},[e]);const r=h.useRef(null),a=h.useCallback(p=>n.setContextValue(J,p),[n]),c=h.useCallback(p=>n.setContextValue(Z,p),[n]);return h.useEffect(()=>{var v;const p=_.fromEvent(document,"focusin").subscribe(S=>{var m;S.target&&((m=s.current)!=null&&m.contains(S.target))?a(!0):a(!1),!r.current||!r.current.selectHasFocus()?c(!0):c(!1)});return(v=r.current)==null||v.focus(),a(!0),c(!0),()=>{p.unsubscribe(),a(!1)}},[a,c]),d.jsx("div",{className:O.findReplaceDialogContainer,ref:s,children:i.replaceRevealed?d.jsx(Ve,{ref:r}):d.jsx(Ge,{ref:r})})}function He(t){const e=t.getCurrentLocale();return h.useMemo(()=>[{label:t.t("find-replace.dialog.find-scope.current-sheet"),value:T.SUBUNIT},{label:t.t("find-replace.dialog.find-scope.workbook"),value:T.UNIT}],[e])}function qe(t){const e=t.getCurrentLocale();return h.useMemo(()=>[{label:t.t("find-replace.dialog.find-direction.row"),value:x.ROW},{label:t.t("find-replace.dialog.find-direction.column"),value:x.COLUMN}],[e])}function ze(t){const e=t.getCurrentLocale();return h.useMemo(()=>[{label:t.t("find-replace.dialog.find-by.value"),value:D.VALUE},{label:t.t("find-replace.dialog.find-by.formula"),value:D.FORMULA}],[e])}function I(t){return t.getContextValue(J)}function Ye(t){return t.getContextValue(Q)}function ne(t){return t.getContextValue(Z)}const N="7_find-replace-shortcuts";function W(t){return t.getContextValue(o.FOCUSING_SHEET)}function G(t){return!t.getContextValue(o.EDITOR_ACTIVATED)}const Ze={id:y.id,description:"find-replace.shortcut.open-find-dialog",binding:l.KeyCode.F|l.MetaKeys.CTRL_COMMAND,group:N,preconditions(t){return!I(t)&&W(t)&&G(t)}},Je={id:y.id,description:"find-replace.shortcut.open-find-dialog",binding:l.KeyCode.F|l.MetaKeys.CTRL_COMMAND,mac:l.KeyCode.F|l.MetaKeys.MAC_CTRL,preconditions(t){return!I(t)&&W(t)&&G(t)}},Qe={id:E.id,description:"find-replace.shortcut.open-replace-dialog",binding:l.KeyCode.H|l.MetaKeys.CTRL_COMMAND,mac:l.KeyCode.H|l.MetaKeys.MAC_CTRL,group:N,preconditions(t){return W(t)&&G(t)&&(!I(t)||!Ye(t))}},Xe={id:B.id,description:"find-replace.shortcut.go-to-next-match",binding:l.KeyCode.ENTER,group:N,priority:1e3,preconditions(t){return ne(t)&&I(t)}},et={id:k.id,description:"find-replace.shortcut.go-to-previous-match",binding:l.KeyCode.ENTER|l.MetaKeys.SHIFT,group:N,priority:1e3,preconditions(t){return ne(t)&&I(t)}};function tt(t){const e=t.get(o.IContextService);return{id:y.id,icon:"SearchIcon",tooltip:"find-replace.toolbar",type:l.MenuItemType.BUTTON,hidden$:l.getMenuHiddenObservable(t,o.UniverInstanceType.UNIVER_SHEET),disabled$:_.combineLatest([e.subscribeContextValue$(o.EDITOR_ACTIVATED),e.subscribeContextValue$(o.FOCUSING_SHEET)]).pipe(_.map(([n,i])=>n||!i))}}const it={[l.RibbonStartGroup.OTHERS]:{[y.id]:{order:2,menuItemFactory:tt}}};var nt=Object.getOwnPropertyDescriptor,st=(t,e,n,i)=>{for(var s=i>1?void 0:i?nt(e,n):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(s=a(s)||s);return s},b=(t,e)=>(n,i)=>e(n,i,t);const K="DESKTOP_FIND_REPLACE_DIALOG",se=350,rt=20,at=-90;exports.FindReplaceController=class extends o.RxDisposable{constructor(n,i,s,r,a,c,p,v,S,m){super();u(this,"_closingListenerDisposable");this._univerInstanceService=n,this._menuManagerService=i,this._shortcutService=s,this._commandService=r,this._findReplaceService=a,this._dialogService=c,this._layoutService=p,this._localeService=v,this._componentManager=S,this._injector=m,this._initCommands(),this._initUI(),this._initShortcuts()}dispose(){var n;super.dispose(),(n=this._closingListenerDisposable)==null||n.dispose(),this._closingListenerDisposable=null}_initCommands(){[y,E,B,k,U,w].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initShortcuts(){[Qe,Ze,Je,et,Xe].forEach(n=>this.disposeWithMe(this._shortcutService.registerShortcut(n)))}_initUI(){this.disposeWithMe(this._componentManager.register("FindReplaceDialog",Ke)),this.disposeWithMe(this._componentManager.register("SearchIcon",Y)),this._menuManagerService.mergeMenu(it),this._findReplaceService.stateUpdates$.pipe(_.takeUntil(this.dispose$)).subscribe(n=>{n.revealed===!0&&this._openPanel()})}_openPanel(){this._dialogService.open({id:K,draggable:!0,width:se,title:{title:this._localeService.t("find-replace.dialog.title")},children:{label:"FindReplaceDialog"},destroyOnClose:!0,defaultPosition:ot(),preservePositionOnDestroy:!0,onClose:()=>this.closePanel()}),this._closingListenerDisposable=o.toDisposable(this._univerInstanceService.focused$.pipe(_.takeUntil(this.dispose$)).subscribe(n=>{(!n||!this._univerInstanceService.getUniverSheetInstance(n))&&this.closePanel()}))}closePanel(){this._closingListenerDisposable&&(this._closingListenerDisposable.dispose(),this._closingListenerDisposable=null,this._dialogService.close(K),this._findReplaceService.terminate(),queueMicrotask(()=>this._layoutService.focus()))}};exports.FindReplaceController=st([b(0,o.IUniverInstanceService),b(1,l.IMenuManagerService),b(2,l.IShortcutService),b(3,o.ICommandService),b(4,R),b(5,l.IDialogService),b(6,l.ILayoutService),b(7,o.Inject(o.LocaleService)),b(8,o.Inject(l.ComponentManager)),b(9,o.Inject(o.Injector))],exports.FindReplaceController);function ot(){const{innerWidth:t}=window;return{x:(t-se)/2-rt,y:at}}var ct=Object.getOwnPropertyDescriptor,lt=(t,e,n,i)=>{for(var s=i>1?void 0:i?ct(e,n):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(s=a(s)||s);return s},H=(t,e)=>(n,i)=>e(n,i,t);const dt="UNIVER_FIND_REPLACE_PLUGIN";var $;exports.UniverFindReplacePlugin=($=class extends o.Plugin{constructor(e=V,n,i){super(),this._config=e,this._injector=n,this._configService=i;const{...s}=o.merge({},V,this._config);this._configService.setConfig(Te,s)}onStarting(){[[exports.FindReplaceController],[R,{useClass:A}]].forEach(e=>this._injector.add(e))}onRendered(){this._injector.get(exports.FindReplaceController)}},u($,"pluginName",dt),$);exports.UniverFindReplacePlugin=lt([H(1,o.Inject(o.Injector)),H(2,o.IConfigService)],exports.UniverFindReplacePlugin);exports.FindBy=D;exports.FindDirection=x;exports.FindModel=je;exports.FindReplaceState=ee;exports.FindScope=T;exports.GoToNextMatchOperation=B;exports.GoToPreviousMatchOperation=k;exports.IFindReplaceService=R;exports.OpenFindDialogOperation=y;exports.OpenReplaceDialogOperation=E;exports.ReplaceAllMatchesCommand=U;exports.ReplaceCurrentMatchCommand=w;exports.createInitFindReplaceState=P;
1
+ "use strict";var xe=Object.defineProperty;var De=(t,e,n)=>e in t?xe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var u=(t,e,n)=>De(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),l=require("@univerjs/ui"),_=require("rxjs"),f=require("@univerjs/design"),Te=require("@univerjs/engine-render"),d=require("react/jsx-runtime"),h=require("react"),Oe="find-replace.config",V={};var R=function(){return R=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},R.apply(this,arguments)},Pe=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]]);return n},q=h.forwardRef(function(t,e){var n=t.icon,i=t.id,s=t.className,r=t.extend,a=Pe(t,["icon","id","className","extend"]),o="univerjs-icon univerjs-icon-".concat(i," ").concat(s||"").trim(),p=h.useRef("_".concat(Le()));return z(n,"".concat(i),{defIds:n.defIds,idSuffix:p.current},R({ref:e,className:o},a),r)});function z(t,e,n,i,s){return h.createElement(t.tag,R(R({key:e},Ee(t,n,s)),i),(Ne(t,n).children||[]).map(function(r,a){return z(r,"".concat(e,"-").concat(t.tag,"-").concat(a),n,void 0,s)}))}function Ee(t,e,n){var i=R({},t.attrs);n!=null&&n.colorChannel1&&i.fill==="colorChannel1"&&(i.fill=n.colorChannel1),t.tag==="mask"&&i.id&&(i.id=i.id+e.idSuffix),Object.entries(i).forEach(function(r){var a=r[0],o=r[1];a==="mask"&&typeof o=="string"&&(i[a]=o.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var s=e.defIds;return!s||s.length===0||(t.tag==="use"&&i["xlink:href"]&&(i["xlink:href"]=i["xlink:href"]+e.idSuffix),Object.entries(i).forEach(function(r){var a=r[0],o=r[1];typeof o=="string"&&(i[a]=o.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),i}function Ne(t,e){var n,i=e.defIds;return!i||i.length===0?t:t.tag==="defs"&&(!((n=t.children)===null||n===void 0)&&n.length)?R(R({},t),{children:t.children.map(function(s){return typeof s.attrs.id=="string"&&i&&i.indexOf(s.attrs.id)>-1?R(R({},s),{attrs:R(R({},s.attrs),{id:s.attrs.id+e.idSuffix})}):s})}):t}function Le(){return Math.random().toString(36).substring(2,8)}q.displayName="UniverIcon";var $e={tag:"svg",attrs:{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"}}]},Y=h.forwardRef(function(t,e){return h.createElement(q,Object.assign({},t,{id:"search-single",ref:e,icon:$e}))});Y.displayName="SearchSingle";const Z="FIND_REPLACE_INPUT_FOCUS",J="FIND_REPLACE_DIALOG_FOCUS",Q="FIND_REPLACE_REPLACE_REVEALED";var je=Object.getOwnPropertyDescriptor,X=(t,e,n,i)=>{for(var s=i>1?void 0:i?je(e,n):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(s=a(s)||s);return s},D=(t,e)=>(n,i)=>e(n,i,t);class Ae extends c.Disposable{}const C=c.createIdentifier("find-replace.service");function we(t){return typeof t.findString<"u"||typeof t.inputtingFindString<"u"||typeof t.findDirection<"u"||typeof t.matchesTheWholeCell<"u"||typeof t.caseSensitive<"u"||typeof t.findScope<"u"||typeof t.findBy<"u"}exports.FindReplaceModel=class extends c.Disposable{constructor(n,i,s,r){super();u(this,"currentMatch$",new _.BehaviorSubject(null));u(this,"replaceables$",new _.BehaviorSubject([]));u(this,"_findModels",[]);u(this,"_matchingModel",null);u(this,"_matches",[]);u(this,"_currentSearchingDisposables",null);this._state=n,this._providers=i,this._univerInstanceService=s,this._commandService=r,this.disposeWithMe(this._state.stateUpdates$.pipe(_.throttleTime(200,void 0,{leading:!0,trailing:!0})).subscribe(async a=>{const o=this._state.state;we(a)&&(o.findString!==""&&!o.replaceRevealed?(await this._startSearching(),this._state.changeState({findCompleted:!0})):a.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({...N(),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),i=this._findModels=(await Promise.all(n.map(r=>r.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(i);const s=this._matches=i.map(r=>r.getMatches()).flat();return this.replaceables$.next(s.filter(r=>r.replaceable)),s.length?(this._moveToInitialMatch(i),this._state.changeState({matchesCount:s.length}),{results:s}):(this._state.changeState({matchesCount:0,matchesPosition:0}),{results:[]})}_stopSearching(){var n;this._providers.forEach(i=>i.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 i=this._currentSearchingDisposables=new c.DisposableCollection,s=_.combineLatest(n.map(r=>r.matchesUpdate$)).pipe(_.debounceTime(220)).subscribe(([...r])=>{const a=this._matches=r.flat();a.length?(this._moveToInitialMatch(this._findModels,!0),this._state.changeState({matchesCount:a.length}),this.replaceables$.next(a.filter(o=>o.replaceable))):(this._state.changeState({matchesCount:0,matchesPosition:0}),this.replaceables$.next([]))});n.forEach(r=>i.add(c.toDisposable(r.activelyChangingMatch$.subscribe(a=>{const o=this._matches.findIndex(p=>p===a);this._state.changeState({matchesPosition:o+1})})))),i.add(c.toDisposable(s))}async replace(){return this._matchingModel?this._matchingModel.replace(this._state.replaceString):!1}async replaceAll(){const n=await Promise.all(this._findModels.map(i=>i.replaceAll(this._state.replaceString))).then(i=>i.reduce((s,r)=>(s.success+=r.success,s.failure+=r.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 i=this._matches.findIndex(s=>s===n);this.currentMatch$.next(n),this._state.changeState({matchesPosition:i+1})}moveToNextMatch(){if(!this._matchingModel)return;const n=this._findModels.length===1,i=this._matchingModel.moveToNextMatch({loop:n});if(i)return this._markMatch(i),i;{const s=this._findModels.findIndex(r=>r===this._matchingModel);return this._moveToNextUnitMatch(s)}}_moveToNextUnitMatch(n){const i=this._findModels.length;for(let s=(n+1)%i;s!==n;){const r=this._findModels[s],a=r.moveToNextMatch({ignoreSelection:!0});if(a)return this._matchingModel=r,this._markMatch(a),a;s=(s+1)%i}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,i=this._matchingModel.moveToPreviousMatch({loop:n});if(i){const s=this._matches.findIndex(r=>r===i);return this.currentMatch$.next(i),this._state.changeState({matchesPosition:s+1}),i}else{const s=this._findModels.length,r=this._findModels.findIndex(o=>o===this._matchingModel);for(let o=(r-1+s)%s;o!==r;){const p=this._findModels[o],v=p.moveToPreviousMatch({ignoreSelection:!0});if(v)return this._matchingModel=p,this._markMatch(v),v;o=(o-1)%s}const a=this._matchingModel.moveToPreviousMatch({ignoreSelection:!0});return a&&this._markMatch(a),a}}_moveToInitialMatch(n,i=!1){var a;const s=(a=this._univerInstanceService.getFocusedUnit())==null?void 0:a.getUnitId();if(!s)return-1;const r=n.findIndex(o=>o.unitId===s);if(r!==-1){this._matchingModel=n[r];const o=this._matchingModel.moveToNextMatch({stayIfOnMatch:!0,noFocus:i});if(o)return this._markMatch(o),r}return this._moveToNextUnitMatch(r),0}};exports.FindReplaceModel=X([D(2,c.IUniverInstanceService),D(3,c.ICommandService)],exports.FindReplaceModel);var T=(t=>(t.ROW="row",t.COLUMN="column",t))(T||{}),O=(t=>(t.VALUE="value",t.FORMULA="formula",t))(O||{}),P=(t=>(t.SUBUNIT="subunit",t.UNIT="unit",t))(P||{});function N(){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 ee{constructor(){u(this,"_stateUpdates$",new _.Subject);u(this,"stateUpdates$",this._stateUpdates$.asObservable());u(this,"_state$",new _.BehaviorSubject(N()));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 i={};typeof e.findString<"u"&&e.findString!==this._findString&&(this._findString=e.findString,i.findString=this._findString,n=!0),typeof e.revealed<"u"&&e.revealed!==this._revealed&&(this._revealed=e.revealed,i.revealed=e.revealed,n=!0),typeof e.replaceRevealed<"u"&&e.replaceRevealed!==this._replaceRevealed&&(this._replaceRevealed=e.replaceRevealed,i.replaceRevealed=e.replaceRevealed,n=!0),typeof e.replaceString<"u"&&e.replaceString!==this._replaceString&&(this._replaceString=e.replaceString,i.replaceString=e.replaceString,n=!0),typeof e.matchesCount<"u"&&e.matchesCount!==this._matchesCount&&(this._matchesCount=e.matchesCount,i.matchesCount=e.matchesCount,n=!0),typeof e.matchesPosition<"u"&&e.matchesPosition!==this._matchesPosition&&(this._matchesPosition=e.matchesPosition,i.matchesPosition=e.matchesPosition,n=!0),typeof e.findBy<"u"&&e.findBy!==this._findBy&&(this._findBy=e.findBy,i.findBy=e.findBy,n=!0),typeof e.findScope<"u"&&e.findScope!==this._findScope&&(this._findScope=e.findScope,i.findScope=e.findScope,n=!0),typeof e.findDirection<"u"&&e.findDirection!==this._findDirection&&(this._findDirection=e.findDirection,i.findDirection=e.findDirection,n=!0),typeof e.caseSensitive<"u"&&e.caseSensitive!==this._caseSensitive&&(this._caseSensitive=e.caseSensitive,i.caseSensitive=e.caseSensitive,n=!0),typeof e.matchesTheWholeCell<"u"&&e.matchesTheWholeCell!==this._matchesTheWholeCell&&(this._matchesTheWholeCell=e.matchesTheWholeCell,i.matchesTheWholeCell=e.matchesTheWholeCell,n=!0),typeof e.inputtingFindString<"u"&&e.inputtingFindString!==this._inputtingFindString&&(this._inputtingFindString=e.inputtingFindString,i.inputtingFindString=e.inputtingFindString,n=!0),typeof e.findCompleted<"u"&&e.findCompleted!==this._findCompleted&&(this._findCompleted=e.findCompleted,i.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(i))}}let A=class extends c.Disposable{constructor(e,n){super();u(this,"_providers",new Set);u(this,"_state",new ee);u(this,"_model");u(this,"_currentMatch$",new _.BehaviorSubject(null));u(this,"currentMatch$",this._currentMatch$.asObservable());u(this,"_replaceables$",new _.BehaviorSubject([]));u(this,"replaceables$",this._replaceables$.asObservable());u(this,"_focusSignal$",new _.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(exports.FindReplaceModel,this._state,this._providers),this._model.currentMatch$.subscribe(i=>this._currentMatch$.next(i)),this._model.replaceables$.subscribe(i=>this._replaceables$.next(i));const n=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),c.toDisposable(()=>this._providers.delete(e))}_toggleRevealReplace(e){this._contextService.setContextValue(Q,e)}_toggleDisplayRawFormula(e){this._contextService.setContextValue(Te.RENDER_RAW_FORMULA_KEY,e)}};A=X([D(0,c.Inject(c.Injector)),D(1,c.IContextService)],A);const w={id:"ui.command.replace-current-match",type:c.CommandType.COMMAND,handler:t=>t.get(C).replace()},Ue="CONFIRM_REPLACE_ALL",U={id:"ui.command.replace-all-matches",type:c.CommandType.COMMAND,handler:async t=>{const e=t.get(l.IConfirmService),n=t.get(c.LocaleService),i=t.get(l.IMessageService);if(!await e.confirm({id:Ue,title:{title:n.t("find-replace.replace.confirm.title")},cancelText:n.t("button.cancel"),confirmText:n.t("button.confirm")}))return!1;const r=await t.get(C).replaceAll(),{success:a,failure:o}=r;return o>0?(a===0?i.show({type:f.MessageType.Error,content:n.t("find-replace.replace.all-failure")}):i.show({type:f.MessageType.Warning,content:n.t("find-replace.replace.partial-success",`${a}`,`${o}`)}),!1):(i.show({type:f.MessageType.Success,content:n.t("find-replace.replace.all-success",`${a}`)}),!0)}},y={id:"ui.operation.open-find-dialog",type:c.CommandType.OPERATION,handler:t=>{const e=t.get(C);return e.revealed?e.focusFindInput():e.start(),!0}},L={id:"ui.operation.open-replace-dialog",type:c.CommandType.OPERATION,handler:t=>{const e=t.get(C);return e.revealed?e.replaceRevealed?e.focusFindInput():e.revealReplace():e.start(!0),!0}},B={type:c.CommandType.OPERATION,id:"ui.operation.go-to-next-match",handler:t=>(t.get(C).moveToNextMatch(),!0)},k={type:c.CommandType.OPERATION,id:"ui.operation.go-to-previous-match",handler:t=>(t.get(C).moveToPreviousMatch(),!0)},te={type:c.CommandType.OPERATION,id:"ui.operation.focus-selection",handler:t=>(t.get(C).focusSelection(),!0)},Be="univer-find-replace-dialog-container",ke="univer-find-replace-expand-container",We="univer-find-replace-buttons-group",Ge="univer-find-replace-buttons-group-right",E={findReplaceDialogContainer:Be,findReplaceExpandContainer:ke,findReplaceButtonsGroup:We,findReplaceButtonsGroupRight:Ge};function ie(t){const{findCompleted:e,localeService:n,matchesCount:i,matchesPosition:s,findString:r,findReplaceService:a,onChange:o,...p}=t,S=e&&i===0?n.t("find-replace.dialog.no-result"):i===0?" ":void 0;return d.jsx(f.InputWithSlot,{autoFocus:!0,placeholder:n.t("find-replace.dialog.find-placeholder"),slot:d.jsx(f.Pager,{loop:!0,text:S,value:s,total:i,onChange:m=>{s===i&&m===1?a.moveToNextMatch():s===1&&m===i||m<s?a.moveToPreviousMatch():a.moveToNextMatch()}}),value:r,onChange:m=>o==null?void 0:o(m),...p})}function ne(t,e){const n=h.useCallback(()=>{var s;(s=document.querySelector(".univer-find-input input"))==null||s.focus()},[]),i=h.useCallback(()=>{const s=document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");return Array.from(s).some(r=>r===document.activeElement)},[]);return h.useImperativeHandle(e,()=>({focus:n,selectHasFocus:i})),h.useEffect(()=>{const s=t.focusSignal$.subscribe(()=>n());return()=>s.unsubscribe()},[t,n]),{focus:n,selectHasFocus:i}}const Ve=h.forwardRef(function(e,n){const i=l.useDependency(c.LocaleService),s=l.useDependency(C),r=l.useDependency(c.ICommandService),a=l.useObservable(s.state$,void 0,!0),{findCompleted:o,findString:p,matchesCount:v,matchesPosition:S}=a,m=h.useCallback(()=>{r.executeCommand(L.id)},[r]),x=h.useCallback(M=>s.changeFindString(M),[s]);return ne(s,n),d.jsxs(d.Fragment,{children:[d.jsx(ie,{findCompleted:o,className:"univer-find-input",matchesCount:v,matchesPosition:S,findReplaceService:s,localeService:i,findString:p,onChange:x}),d.jsx("div",{className:E.findReplaceExpandContainer,children:d.jsx(f.Button,{type:"text",size:"small",onClick:m,children:i.t("find-replace.dialog.advanced-finding")})})]})}),Ke=h.forwardRef(function(e,n){const i=l.useDependency(C),s=l.useDependency(c.LocaleService),r=l.useDependency(c.ICommandService),a=l.useDependency(l.IMessageService),o=l.useObservable(i.currentMatch$,void 0,!0),p=l.useObservable(i.replaceables$,void 0,!0),v=l.useObservable(i.state$,void 0,!0),{matchesCount:S,matchesPosition:m,findString:x,inputtingFindString:M,replaceString:ae,caseSensitive:oe,matchesTheWholeCell:ce,findDirection:le,findScope:de,findBy:ue,findCompleted:$}=v,he=M.length===0,pe=S===0||!(o!=null&&o.replaceable),fe=p.length===0,ge=h.useCallback(g=>i.changeInputtingFindString(g),[i]),_e=h.useCallback(g=>i.changeReplaceString(g),[i]),{focus:me}=ne(i,n),ve=h.useCallback(()=>{x===M?i.moveToNextMatch():(i.changeFindString(M),i.find())},[x,M,i]),Se=h.useCallback(()=>r.executeCommand(w.id),[r]),Ce=h.useCallback(async()=>{await r.executeCommand(U.id),me()},[r]),Re=h.useCallback(g=>{i.changeFindDirection(g)},[i]),be=h.useCallback(g=>{i.changeFindScope(g)},[i]),Me=h.useCallback(g=>{i.changeFindBy(g)},[i]),ye=qe(s),Ie=ze(s),Fe=Ye(s);return h.useEffect(()=>{$&&S===0&&a.show({content:s.t("find-replace.dialog.no-match"),type:f.MessageType.Warning,duration:5e3})},[$,S,a,s]),d.jsxs(d.Fragment,{children:[d.jsx(f.FormLayout,{label:s.t("find-replace.dialog.find"),children:d.jsx(ie,{findCompleted:$,className:"univer-find-input",matchesCount:S,matchesPosition:m,findReplaceService:i,localeService:s,findString:M,onChange:ge})}),d.jsx(f.FormLayout,{label:s.t("find-replace.dialog.replace"),children:d.jsx(f.Input,{placeholder:s.t("find-replace.dialog.replace-placeholder"),value:ae,onChange:g=>_e(g)})}),d.jsx(f.FormLayout,{label:s.t("find-replace.dialog.find-direction.title"),children:d.jsx(f.Select,{value:le,options:Ie,onChange:Re})}),d.jsx(f.FormDualColumnLayout,{children:d.jsxs(d.Fragment,{children:[d.jsx(f.FormLayout,{label:s.t("find-replace.dialog.find-scope.title"),children:d.jsx(f.Select,{value:de,options:ye,onChange:be})}),d.jsx(f.FormLayout,{label:s.t("find-replace.dialog.find-by.title"),children:d.jsx(f.Select,{value:ue,options:Fe,onChange:Me})})]})}),d.jsx(f.FormDualColumnLayout,{children:d.jsxs(d.Fragment,{children:[d.jsx(f.FormLayout,{children:d.jsx(f.Checkbox,{checked:oe,onChange:g=>{i.changeCaseSensitive(g)},children:s.t("find-replace.dialog.case-sensitive")})}),d.jsx(f.FormLayout,{children:d.jsx(f.Checkbox,{checked:ce,onChange:g=>{i.changeMatchesTheWholeCell(g)},children:s.t("find-replace.dialog.match-the-whole-cell")})})]})}),d.jsxs("div",{className:E.findReplaceButtonsGroup,children:[d.jsx(f.Button,{type:"primary",onClick:ve,disabled:he,children:s.t("find-replace.dialog.find")}),d.jsxs("span",{className:E.findReplaceButtonsGroupRight,children:[d.jsx(f.Button,{disabled:pe,onClick:Se,children:s.t("find-replace.dialog.replace")}),d.jsx(f.Button,{disabled:fe,onClick:Ce,children:s.t("find-replace.dialog.replace-all")})]})]})]})});function He(){const t=l.useDependency(C),e=l.useDependency(l.ILayoutService),n=l.useDependency(c.IContextService),i=l.useObservable(t.state$,void 0,!0),s=h.useRef(null);h.useEffect(()=>{let p;return s.current&&(p=e.registerContainerElement(s.current)),()=>p==null?void 0:p.dispose()},[e]);const r=h.useRef(null),a=h.useCallback(p=>n.setContextValue(J,p),[n]),o=h.useCallback(p=>n.setContextValue(Z,p),[n]);return h.useEffect(()=>{var v;const p=_.fromEvent(document,"focusin").subscribe(S=>{var m;S.target&&((m=s.current)!=null&&m.contains(S.target))?a(!0):a(!1),!r.current||!r.current.selectHasFocus()?o(!0):o(!1)});return(v=r.current)==null||v.focus(),a(!0),o(!0),()=>{p.unsubscribe(),a(!1)}},[a,o]),d.jsx("div",{className:E.findReplaceDialogContainer,ref:s,children:i.replaceRevealed?d.jsx(Ke,{ref:r}):d.jsx(Ve,{ref:r})})}function qe(t){const e=t.getCurrentLocale();return h.useMemo(()=>[{label:t.t("find-replace.dialog.find-scope.current-sheet"),value:P.SUBUNIT},{label:t.t("find-replace.dialog.find-scope.workbook"),value:P.UNIT}],[e])}function ze(t){const e=t.getCurrentLocale();return h.useMemo(()=>[{label:t.t("find-replace.dialog.find-direction.row"),value:T.ROW},{label:t.t("find-replace.dialog.find-direction.column"),value:T.COLUMN}],[e])}function Ye(t){const e=t.getCurrentLocale();return h.useMemo(()=>[{label:t.t("find-replace.dialog.find-by.value"),value:O.VALUE},{label:t.t("find-replace.dialog.find-by.formula"),value:O.FORMULA}],[e])}function I(t){return t.getContextValue(J)}function Ze(t){return t.getContextValue(Q)}function se(t){return t.getContextValue(Z)}const F="7_find-replace-shortcuts";function W(t){return t.getContextValue(c.FOCUSING_SHEET)}function G(t){return!t.getContextValue(c.EDITOR_ACTIVATED)}const Je={id:y.id,description:"find-replace.shortcut.open-find-dialog",binding:l.KeyCode.F|l.MetaKeys.CTRL_COMMAND,group:F,preconditions(t){return!I(t)&&W(t)&&G(t)}},Qe={id:y.id,description:"find-replace.shortcut.open-find-dialog",binding:l.KeyCode.F|l.MetaKeys.CTRL_COMMAND,mac:l.KeyCode.F|l.MetaKeys.MAC_CTRL,preconditions(t){return!I(t)&&W(t)&&G(t)}},Xe={id:L.id,description:"find-replace.shortcut.open-replace-dialog",binding:l.KeyCode.H|l.MetaKeys.CTRL_COMMAND,mac:l.KeyCode.H|l.MetaKeys.MAC_CTRL,group:F,preconditions(t){return W(t)&&G(t)&&(!I(t)||!Ze(t))}},et={id:B.id,description:"find-replace.shortcut.go-to-next-match",binding:l.KeyCode.ENTER,group:F,priority:1e3,preconditions(t){return se(t)&&I(t)}},tt={id:k.id,description:"find-replace.shortcut.go-to-previous-match",binding:l.KeyCode.ENTER|l.MetaKeys.SHIFT,group:F,priority:1e3,preconditions(t){return se(t)&&I(t)}},it={id:te.id,description:"find-replace.shortcut.focus-selection",binding:l.KeyCode.ESC,group:F,priority:1e3,preconditions(t){return I(t)}};function nt(t){const e=t.get(c.IContextService);return{id:y.id,icon:"SearchIcon",tooltip:"find-replace.toolbar",type:l.MenuItemType.BUTTON,hidden$:l.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),disabled$:_.combineLatest([e.subscribeContextValue$(c.EDITOR_ACTIVATED),e.subscribeContextValue$(c.FOCUSING_SHEET)]).pipe(_.map(([n,i])=>n||!i))}}const st={[l.RibbonStartGroup.OTHERS]:{[y.id]:{order:2,menuItemFactory:nt}}};var rt=Object.getOwnPropertyDescriptor,at=(t,e,n,i)=>{for(var s=i>1?void 0:i?rt(e,n):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(s=a(s)||s);return s},b=(t,e)=>(n,i)=>e(n,i,t);const K="DESKTOP_FIND_REPLACE_DIALOG",re=350,ot=20,ct=-90;exports.FindReplaceController=class extends c.RxDisposable{constructor(n,i,s,r,a,o,p,v,S,m){super();u(this,"_closingListenerDisposable");this._univerInstanceService=n,this._menuManagerService=i,this._shortcutService=s,this._commandService=r,this._findReplaceService=a,this._dialogService=o,this._layoutService=p,this._localeService=v,this._componentManager=S,this._injector=m,this._initCommands(),this._initUI(),this._initShortcuts()}dispose(){var n;super.dispose(),(n=this._closingListenerDisposable)==null||n.dispose(),this._closingListenerDisposable=null}_initCommands(){[y,L,B,k,U,w,te].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initShortcuts(){[Xe,Je,Qe,tt,et,it].forEach(n=>this.disposeWithMe(this._shortcutService.registerShortcut(n)))}_initUI(){this.disposeWithMe(this._componentManager.register("FindReplaceDialog",He)),this.disposeWithMe(this._componentManager.register("SearchIcon",Y)),this._menuManagerService.mergeMenu(st),this._findReplaceService.stateUpdates$.pipe(_.takeUntil(this.dispose$)).subscribe(n=>{n.revealed===!0&&this._openPanel()})}_openPanel(){this._dialogService.open({id:K,draggable:!0,width:re,title:{title:this._localeService.t("find-replace.dialog.title")},children:{label:"FindReplaceDialog"},destroyOnClose:!0,defaultPosition:lt(),preservePositionOnDestroy:!0,onClose:()=>this.closePanel()}),this._closingListenerDisposable=c.toDisposable(this._univerInstanceService.focused$.pipe(_.takeUntil(this.dispose$)).subscribe(n=>{(!n||!this._univerInstanceService.getUniverSheetInstance(n))&&this.closePanel()}))}closePanel(){this._closingListenerDisposable&&(this._closingListenerDisposable.dispose(),this._closingListenerDisposable=null,this._dialogService.close(K),this._findReplaceService.terminate(),queueMicrotask(()=>this._layoutService.focus()))}};exports.FindReplaceController=at([b(0,c.IUniverInstanceService),b(1,l.IMenuManagerService),b(2,l.IShortcutService),b(3,c.ICommandService),b(4,C),b(5,l.IDialogService),b(6,l.ILayoutService),b(7,c.Inject(c.LocaleService)),b(8,c.Inject(l.ComponentManager)),b(9,c.Inject(c.Injector))],exports.FindReplaceController);function lt(){const{innerWidth:t}=window;return{x:(t-re)/2-ot,y:ct}}var dt=Object.getOwnPropertyDescriptor,ut=(t,e,n,i)=>{for(var s=i>1?void 0:i?dt(e,n):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(s=a(s)||s);return s},H=(t,e)=>(n,i)=>e(n,i,t);const ht="UNIVER_FIND_REPLACE_PLUGIN";var j;exports.UniverFindReplacePlugin=(j=class extends c.Plugin{constructor(e=V,n,i){super(),this._config=e,this._injector=n,this._configService=i;const{...s}=c.merge({},V,this._config);this._configService.setConfig(Oe,s)}onStarting(){[[exports.FindReplaceController],[C,{useClass:A}]].forEach(e=>this._injector.add(e))}onRendered(){this._injector.get(exports.FindReplaceController)}},u(j,"pluginName",ht),j);exports.UniverFindReplacePlugin=ut([H(1,c.Inject(c.Injector)),H(2,c.IConfigService)],exports.UniverFindReplacePlugin);exports.FindBy=O;exports.FindDirection=T;exports.FindModel=Ae;exports.FindReplaceState=ee;exports.FindScope=P;exports.GoToNextMatchOperation=B;exports.GoToPreviousMatchOperation=k;exports.IFindReplaceService=C;exports.OpenFindDialogOperation=y;exports.OpenReplaceDialogOperation=L;exports.ReplaceAllMatchesCommand=U;exports.ReplaceCurrentMatchCommand=w;exports.createInitFindReplaceState=N;
@@ -1 +1 @@
1
- "use strict";const e={"find-replace":{toolbar:"Find & Replace",shortcut:{"open-find-dialog":"Open Find Dialog","open-replace-dialog":"Open Replace Dialog","close-dialog":"Close Find & Replace Dialog","go-to-next-match":"Go to Next Match","go-to-previous-match":"Go to Previous Match"},dialog:{title:"Find",find:"Find",replace:"Replace","replace-all":"Replace All","case-sensitive":"Case Sensitive","find-placeholder":"Find in this Sheet","advanced-finding":"Advanced Searching & Replace","replace-placeholder":"Input Replace String","match-the-whole-cell":"Match the Whole Cell","find-direction":{title:"Find Direction",row:"Search by Row",column:"Search by Column"},"find-scope":{title:"Find Range","current-sheet":"Current Sheet",workbook:"Workbook"},"find-by":{title:"Find By",value:"Find by Value",formula:"Find Formula"},"no-match":"Finding completed but no match found.","no-result":"No Result"},replace:{"all-success":"Replaced all {0} matches","all-failure":"Replace failed",confirm:{title:"Are you sure to replace all matches?"}}},"find-replace-shortcuts":"Find & Replace"};module.exports=e;
1
+ "use strict";const e={"find-replace":{toolbar:"Find & Replace",shortcut:{"open-find-dialog":"Open Find Dialog","open-replace-dialog":"Open Replace Dialog","close-dialog":"Close Find & Replace Dialog","go-to-next-match":"Go to Next Match","go-to-previous-match":"Go to Previous Match","focus-selection":"Focus Selection"},dialog:{title:"Find",find:"Find",replace:"Replace","replace-all":"Replace All","case-sensitive":"Case Sensitive","find-placeholder":"Find in this Sheet","advanced-finding":"Advanced Searching & Replace","replace-placeholder":"Input Replace String","match-the-whole-cell":"Match the Whole Cell","find-direction":{title:"Find Direction",row:"Search by Row",column:"Search by Column"},"find-scope":{title:"Find Range","current-sheet":"Current Sheet",workbook:"Workbook"},"find-by":{title:"Find By",value:"Find by Value",formula:"Find Formula"},"no-match":"Finding completed but no match found.","no-result":"No Result"},replace:{"all-success":"Replaced all {0} matches","all-failure":"Replace failed",confirm:{title:"Are you sure to replace all matches?"}}},"find-replace-shortcuts":"Find & Replace"};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={"find-replace":{toolbar:"یافتن و جایگزینی",shortcut:{"open-find-dialog":"باز کردن پنجره گفتگوی یافتن","open-replace-dialog":"باز کردن پنجره گفتگوی جایگزینی","close-dialog":"بستن پنجره گفتگوی یافتن و جایگزینی","go-to-next-match":"رفتن به تطابق بعدی","go-to-previous-match":"رفتن به تطابق قبلی"},dialog:{title:"یافتن",find:"یافتن",replace:"جایگزینی","replace-all":"جایگزینی همه","case-sensitive":"حساس به حروف کوچک و بزرگ","find-placeholder":"یافتن در این برگ","advanced-finding":"جستجوی پیشرفته و جایگزینی","replace-placeholder":"ورود رشته جایگزین","match-the-whole-cell":"مطابقت با کل سلول","find-direction":{title:"جهت یافتن",row:"جستجو بر اساس سطر",column:"جستجو بر اساس ستون"},"find-scope":{title:"محدوده یافتن","current-sheet":"برگ فعلی",workbook:"کتاب کار"},"find-by":{title:"یافتن بر اساس",value:"یافتن بر اساس مقدار",formula:"یافتن فرمول"},"no-match":"یافتن تکمیل شد اما هیچ تطابقی یافت نشد.","no-result":"نتیجه‌ای وجود ندارد"},replace:{"all-success":"همه {0} تطابق جایگزین شد","all-failure":"جایگزینی ناموفق بود",confirm:{title:"آیا مطمئن هستید که همه تطابق‌ها را جایگزین کنید؟"}}},"find-replace-shortcuts":"یافتن و جایگزینی"};module.exports=e;
1
+ "use strict";const e={"find-replace":{toolbar:"یافتن و جایگزینی",shortcut:{"open-find-dialog":"باز کردن پنجره گفتگوی یافتن","open-replace-dialog":"باز کردن پنجره گفتگوی جایگزینی","close-dialog":"بستن پنجره گفتگوی یافتن و جایگزینی","go-to-next-match":"رفتن به تطابق بعدی","go-to-previous-match":"رفتن به تطابق قبلی","focus-selection":"تمرکز بر روی انتخاب"},dialog:{title:"یافتن",find:"یافتن",replace:"جایگزینی","replace-all":"جایگزینی همه","case-sensitive":"حساس به حروف کوچک و بزرگ","find-placeholder":"یافتن در این برگ","advanced-finding":"جستجوی پیشرفته و جایگزینی","replace-placeholder":"ورود رشته جایگزین","match-the-whole-cell":"مطابقت با کل سلول","find-direction":{title:"جهت یافتن",row:"جستجو بر اساس سطر",column:"جستجو بر اساس ستون"},"find-scope":{title:"محدوده یافتن","current-sheet":"برگ فعلی",workbook:"کتاب کار"},"find-by":{title:"یافتن بر اساس",value:"یافتن بر اساس مقدار",formula:"یافتن فرمول"},"no-match":"یافتن تکمیل شد اما هیچ تطابقی یافت نشد.","no-result":"نتیجه‌ای وجود ندارد"},replace:{"all-success":"همه {0} تطابق جایگزین شد","all-failure":"جایگزینی ناموفق بود",confirm:{title:"آیا مطمئن هستید که همه تطابق‌ها را جایگزین کنید؟"}}},"find-replace-shortcuts":"یافتن و جایگزینی"};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={"find-replace":{toolbar:"Rechercher & Remplacer",shortcut:{"open-find-dialog":"Ouvrir la boîte de dialogue Rechercher","open-replace-dialog":"Ouvrir la boîte de dialogue Remplacer","close-dialog":"Fermer la boîte de dialogue Rechercher & Remplacer","go-to-next-match":"Aller à la correspondance suivante","go-to-previous-match":"Aller à la correspondance précédente"},dialog:{title:"Rechercher",find:"Rechercher",replace:"Remplacer","replace-all":"Remplacer tout","case-sensitive":"Sensible à la casse","find-placeholder":"Rechercher dans cette feuille","advanced-finding":"Recherche avancée & Remplacer","replace-placeholder":"Entrer la chaîne de remplacement","match-the-whole-cell":"Correspondre à toute la cellule","find-direction":{title:"Direction de recherche",row:"Rechercher par ligne",column:"Rechercher par colonne"},"find-scope":{title:"Plage de recherche","current-sheet":"Feuille actuelle",workbook:"Classeur"},"find-by":{title:"Rechercher par",value:"Rechercher par valeur",formula:"Rechercher par formule"},"no-match":"Recherche terminée mais aucune correspondance trouvée.","no-result":"Aucun résultat"},replace:{"all-success":"Remplacé toutes les {0} correspondances","all-failure":"Échec du remplacement",confirm:{title:"Êtes-vous sûr de vouloir remplacer toutes les correspondances?"}}},"find-replace-shortcuts":"Rechercher & Remplacer"};module.exports=e;
1
+ "use strict";const e={"find-replace":{toolbar:"Rechercher & Remplacer",shortcut:{"open-find-dialog":"Ouvrir la boîte de dialogue Rechercher","open-replace-dialog":"Ouvrir la boîte de dialogue Remplacer","close-dialog":"Fermer la boîte de dialogue Rechercher & Remplacer","go-to-next-match":"Aller à la correspondance suivante","go-to-previous-match":"Aller à la correspondance précédente","focus-selection":"Focus sur la sélection"},dialog:{title:"Rechercher",find:"Rechercher",replace:"Remplacer","replace-all":"Remplacer tout","case-sensitive":"Sensible à la casse","find-placeholder":"Rechercher dans cette feuille","advanced-finding":"Recherche avancée & Remplacer","replace-placeholder":"Entrer la chaîne de remplacement","match-the-whole-cell":"Correspondre à toute la cellule","find-direction":{title:"Direction de recherche",row:"Rechercher par ligne",column:"Rechercher par colonne"},"find-scope":{title:"Plage de recherche","current-sheet":"Feuille actuelle",workbook:"Classeur"},"find-by":{title:"Rechercher par",value:"Rechercher par valeur",formula:"Rechercher par formule"},"no-match":"Recherche terminée mais aucune correspondance trouvée.","no-result":"Aucun résultat"},replace:{"all-success":"Remplacé toutes les {0} correspondances","all-failure":"Échec du remplacement",confirm:{title:"Êtes-vous sûr de vouloir remplacer toutes les correspondances?"}}},"find-replace-shortcuts":"Rechercher & Remplacer"};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={"find-replace":{toolbar:"Найти и заменить",shortcut:{"open-find-dialog":"Открыть диалог поиска","open-replace-dialog":"Открыть диалог замены","close-dialog":"Закрыть диалог поиска и замены","go-to-next-match":"Перейти к следующему совпадению","go-to-previous-match":"Перейти к предыдущему совпадению"},dialog:{title:"Найти",find:"Найти",replace:"Заменить","replace-all":"Заменить все","case-sensitive":"С учетом регистра","find-placeholder":"Найти в этом листе","advanced-finding":"Расширенный поиск и замена","replace-placeholder":"Введите строку для замены","match-the-whole-cell":"Точное совпадение","find-direction":{title:"Направление поиска",row:"Поиск по строкам",column:"Поиск по столбцам"},"find-scope":{title:"Область поиска","current-sheet":"Текущий лист",workbook:"Книга"},"find-by":{title:"Поиск по",value:"Поиск по значению",formula:"Поиск по формуле"},"no-match":"Поиск завершен, совпадений не найдено.","no-result":"Нет результатов"},replace:{"all-success":"Заменены все {0} совпадений","all-failure":"Не удалось заменить",confirm:{title:"Вы уверены, что хотите заменить все совпадения?"}}},"find-replace-shortcuts":"Найти и заменить"};module.exports=e;
1
+ "use strict";const e={"find-replace":{toolbar:"Найти и заменить",shortcut:{"open-find-dialog":"Открыть диалог поиска","open-replace-dialog":"Открыть диалог замены","close-dialog":"Закрыть диалог поиска и замены","go-to-next-match":"Перейти к следующему совпадению","go-to-previous-match":"Перейти к предыдущему совпадению","focus-selection":"Фокус на выделении"},dialog:{title:"Найти",find:"Найти",replace:"Заменить","replace-all":"Заменить все","case-sensitive":"С учетом регистра","find-placeholder":"Найти в этом листе","advanced-finding":"Расширенный поиск и замена","replace-placeholder":"Введите строку для замены","match-the-whole-cell":"Точное совпадение","find-direction":{title:"Направление поиска",row:"Поиск по строкам",column:"Поиск по столбцам"},"find-scope":{title:"Область поиска","current-sheet":"Текущий лист",workbook:"Книга"},"find-by":{title:"Поиск по",value:"Поиск по значению",formula:"Поиск по формуле"},"no-match":"Поиск завершен, совпадений не найдено.","no-result":"Нет результатов"},replace:{"all-success":"Заменены все {0} совпадений","all-failure":"Не удалось заменить",confirm:{title:"Вы уверены, что хотите заменить все совпадения?"}}},"find-replace-shortcuts":"Найти и заменить"};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const t={"find-replace":{toolbar:"Tìm kiếm và Thay thế",shortcut:{"open-find-dialog":"Mở hộp thoại tìm kiếm","open-replace-dialog":"Mở hộp thoại thay thế","close-dialog":"Đóng hộp thoại tìm kiếm và thay thế","go-to-next-match":"Đến mục khớp tiếp theo","go-to-previous-match":"Đến mục khớp trước đó"},dialog:{title:"Tìm kiếm",find:"Tìm kiếm",replace:"Thay thế","replace-all":"Thay thế tất cả","find-placeholder":"Nhập nội dung tìm kiếm","advanced-finding":"Thay thế / Tìm kiếm nâng cao","replace-placeholder":"Nhập nội dung thay thế","case-sensitive":"Phân biệt chữ hoa chữ thường","match-the-whole-cell":"Khớp toàn bộ ô","find-scope":{title:"Phạm vi tìm kiếm","current-sheet":"Bảng hiện tại",workbook:"Toàn bộ sổ làm việc"},"find-direction":{title:"Thứ tự tìm kiếm",column:"Tìm theo cột",row:"Tìm theo hàng"},"find-by":{title:"Phương thức tìm kiếm",formula:"Tìm công thức",value:"Tìm giá trị"},"no-match":"Đã hoàn thành tìm kiếm nhưng không tìm thấy mục nào khớp","no-result":"Không có kết quả"},replace:{"all-success":"Đã thay thế tất cả {0} mục khớp","all-failure":"Thay thế thất bại",confirm:{title:"Bạn có chắc muốn thay thế tất cả các mục khớp không?"}}},"find-replace-shortcuts":"Tìm kiếm và Thay thế"};module.exports=t;
1
+ "use strict";const t={"find-replace":{toolbar:"Tìm kiếm và Thay thế",shortcut:{"open-find-dialog":"Mở hộp thoại tìm kiếm","open-replace-dialog":"Mở hộp thoại thay thế","close-dialog":"Đóng hộp thoại tìm kiếm và thay thế","go-to-next-match":"Đến mục khớp tiếp theo","go-to-previous-match":"Đến mục khớp trước đó","focus-selection":"Tập trung vào lựa chọn"},dialog:{title:"Tìm kiếm",find:"Tìm kiếm",replace:"Thay thế","replace-all":"Thay thế tất cả","find-placeholder":"Nhập nội dung tìm kiếm","advanced-finding":"Thay thế / Tìm kiếm nâng cao","replace-placeholder":"Nhập nội dung thay thế","case-sensitive":"Phân biệt chữ hoa chữ thường","match-the-whole-cell":"Khớp toàn bộ ô","find-scope":{title:"Phạm vi tìm kiếm","current-sheet":"Bảng hiện tại",workbook:"Toàn bộ sổ làm việc"},"find-direction":{title:"Thứ tự tìm kiếm",column:"Tìm theo cột",row:"Tìm theo hàng"},"find-by":{title:"Phương thức tìm kiếm",formula:"Tìm công thức",value:"Tìm giá trị"},"no-match":"Đã hoàn thành tìm kiếm nhưng không tìm thấy mục nào khớp","no-result":"Không có kết quả"},replace:{"all-success":"Đã thay thế tất cả {0} mục khớp","all-failure":"Thay thế thất bại",confirm:{title:"Bạn có chắc muốn thay thế tất cả các mục khớp không?"}}},"find-replace-shortcuts":"Tìm kiếm và Thay thế"};module.exports=t;
@@ -1 +1 @@
1
- "use strict";const e={"find-replace":{toolbar:"查找替换",shortcut:{"open-find-dialog":"打开查找对话框","open-replace-dialog":"打开替换对话框","close-dialog":"关闭查找替换对话框","go-to-next-match":"下一个匹配项","go-to-previous-match":"下一个匹配项"},dialog:{title:"查找",find:"查找",replace:"替换","replace-all":"替换全部","find-placeholder":"输入查找内容","advanced-finding":"替换 / 高级查找","replace-placeholder":"输入替换内容","case-sensitive":"匹配大小写","match-the-whole-cell":"匹配整个单元格","find-scope":{title:"查找范围","current-sheet":"当前子表",workbook:"整个工作簿"},"find-direction":{title:"查找顺序",column:"按列查找",row:"按行查找"},"find-by":{title:"查找方式",formula:"查找公式",value:"查找值"},"no-match":"已完成搜索,但是未找到任何匹配项","no-result":"无结果"},replace:{"all-success":"已全部替换 {0} 个匹配项","all-failure":"替换失败",confirm:{title:"确定要替换所有的匹配项吗?"}}},"find-replace-shortcuts":"查找替换"};module.exports=e;
1
+ "use strict";const e={"find-replace":{toolbar:"查找替换",shortcut:{"open-find-dialog":"打开查找对话框","open-replace-dialog":"打开替换对话框","close-dialog":"关闭查找替换对话框","go-to-next-match":"下一个匹配项","go-to-previous-match":"下一个匹配项","focus-selection":"聚焦选区"},dialog:{title:"查找",find:"查找",replace:"替换","replace-all":"替换全部","find-placeholder":"输入查找内容","advanced-finding":"替换 / 高级查找","replace-placeholder":"输入替换内容","case-sensitive":"匹配大小写","match-the-whole-cell":"匹配整个单元格","find-scope":{title:"查找范围","current-sheet":"当前子表",workbook:"整个工作簿"},"find-direction":{title:"查找顺序",column:"按列查找",row:"按行查找"},"find-by":{title:"查找方式",formula:"查找公式",value:"查找值"},"no-match":"已完成搜索,但是未找到任何匹配项","no-result":"无结果"},replace:{"all-success":"已全部替换 {0} 个匹配项","all-failure":"替换失败",confirm:{title:"确定要替换所有的匹配项吗?"}}},"find-replace-shortcuts":"查找替换"};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={"find-replace":{toolbar:"尋找替換",shortcut:{"open-find-dialog":"開啟尋找對話框","open-replace-dialog":"開啟替換對話框","close-dialog":"關閉查找替換對話框","go-to-next-match":"下一個匹配項","go-to-previous-match":"下一個匹配項"},dialog:{title:"找",find:"找",replace:"替換","replace-all":"替換全部","find-placeholder":"輸入查找內容","advanced-finding":"取代 / 進階查找","replace-placeholder":"輸入替換內容","case-sensitive":"匹配大小寫","match-the-whole-cell":"符合整個儲存格","find-scope":{title:"找出範圍","current-sheet":"目前子表",workbook:"整個工作簿"},"find-direction":{title:"找出順序",column:"按列查找",row:"按行查找"},"find-by":{title:"找出方式",formula:"找出公式",value:"查找值"},"no-match":"已完成搜索,但是未找到任何匹配項","no-result":"無結果"},replace:{"all-success":"已全部替換 {0} 個匹配項","all-failure":"替換失敗",confirm:{title:"確定要取代所有的符合項目嗎? "}}},"find-replace-shortcuts":"尋找替換"};module.exports=e;
1
+ "use strict";const e={"find-replace":{toolbar:"尋找替換",shortcut:{"open-find-dialog":"開啟尋找對話框","open-replace-dialog":"開啟替換對話框","close-dialog":"關閉查找替換對話框","go-to-next-match":"下一個匹配項","go-to-previous-match":"下一個匹配項","focus-selection":"聚焦選區"},dialog:{title:"找",find:"找",replace:"替換","replace-all":"替換全部","find-placeholder":"輸入查找內容","advanced-finding":"取代 / 進階查找","replace-placeholder":"輸入替換內容","case-sensitive":"匹配大小寫","match-the-whole-cell":"符合整個儲存格","find-scope":{title:"找出範圍","current-sheet":"目前子表",workbook:"整個工作簿"},"find-direction":{title:"找出順序",column:"按列查找",row:"按行查找"},"find-by":{title:"找出方式",formula:"找出公式",value:"查找值"},"no-match":"已完成搜索,但是未找到任何匹配項","no-result":"無結果"},replace:{"all-success":"已全部替換 {0} 個匹配項","all-failure":"替換失敗",confirm:{title:"確定要取代所有的符合項目嗎? "}}},"find-replace-shortcuts":"尋找替換"};module.exports=e;