@univerjs/preset-sheets-find-replace 0.10.3 → 0.10.5
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/umd/index.js +3 -3
- package/lib/umd/locales/ca-ES.js +2 -2
- package/lib/umd/locales/en-US.js +2 -2
- package/lib/umd/locales/es-ES.js +2 -2
- package/lib/umd/locales/fa-IR.js +2 -2
- package/lib/umd/locales/fr-FR.js +2 -2
- package/lib/umd/locales/ko-KR.js +2 -2
- package/lib/umd/locales/ru-RU.js +2 -2
- package/lib/umd/locales/vi-VN.js +2 -2
- package/lib/umd/locales/zh-CN.js +2 -2
- package/lib/umd/locales/zh-TW.js +2 -2
- package/package.json +5 -5
package/lib/umd/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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(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"})}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/sheets-find-replace/index
|
|
6
|
-
(function(_,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-render"),require("@univerjs/find-replace"),require("@univerjs/sheets-ui"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-render","@univerjs/find-replace","@univerjs/sheets-ui","rxjs"],a):(_=typeof globalThis<"u"?globalThis:_||self,a(_.UniverSheetsFindReplace={},_.UniverCore,_.UniverSheets,_.UniverEngineRender,_.UniverFindReplace,_.UniverSheetsUi,_.rxjs))})(this,function(_,a,p,w,S,M,R){"use strict";var fe=Object.defineProperty;var Se=(_,a,p)=>a in _?fe(_,a,{enumerable:!0,configurable:!0,writable:!0,value:p}):_[a]=p;var m=(_,a,p)=>Se(_,typeof a!="symbol"?a+"":a,p);const F={id:"sheet.command.replace",type:a.CommandType.COMMAND,handler:async(h,e)=>{const t=h.get(a.IUndoRedoService),i=h.get(a.ICommandService),{unitId:n,replacements:r}=e,s=t.__tempBatchingUndoRedo(n),o=await Promise.all(r.map(c=>i.executeCommand(p.SetRangeValuesCommand.id,{unitId:n,subUnitId:c.subUnitId,value:c.value})));return s.dispose(),G(o,r)}};function G(h,e){let t=0,i=0;return h.forEach((n,r)=>{const s=e[r].count;n?t+=s:i+=s}),{success:t,failure:i}}class Y extends w.Shape{constructor(t,i){super(t,i);m(this,"_activated",!1);m(this,"_inHiddenRange",!1);m(this,"_color");i&&this.setShapeProps(i)}setShapeProps(t){this._activated=!!t.activated,typeof t.inHiddenRange<"u"&&(this._inHiddenRange=t.inHiddenRange),typeof t.color<"u"&&(this._color=t.color),this.transformByState({width:t.width,height:t.height})}_draw(t){const i=this._activated,n=`rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, 0.35)`,r=`rgb(${this._color.r}, ${this._color.g}, ${this._color.b})`;w.Rect.drawWith(t,{width:this.width,height:this.height,fill:n,stroke:i?r:void 0,strokeWidth:i?2:0,evented:!1})}}function T(h,e){return h.startRow===e.startRow&&h.startColumn===e.startColumn}function H(h,e){return h.startRow<e.startRow||h.startRow===e.startRow&&h.startColumn<=e.startColumn}function E(h,e){return h.startColumn<e.startColumn||h.startColumn===e.startColumn&&h.startRow<=e.startRow}function q(h,e){return h.startRow>e.startRow||h.startRow===e.startRow&&h.startColumn>=e.startColumn}function K(h,e){return h.startColumn>e.startColumn||h.startColumn===e.startColumn&&h.startRow>=e.startRow}function Q(h,e){const{range:t}=h,{startRow:i,startColumn:n}=t,r=e.getMergedCell(i,n);return r?a.Rectangle.equals(t,r):t.endRow===t.startRow&&t.endColumn===t.startColumn}var X=Object.getOwnPropertyDescriptor,U=(h,e,t,i)=>{for(var n=i>1?void 0:i?X(e,t):e,r=h.length-1,s;r>=0;r--)(s=h[r])&&(n=s(n)||n);return n},C=(h,e)=>(t,i)=>e(t,i,h);_.SheetsFindReplaceController=class extends a.Disposable{constructor(t,i,n,r,s){super();m(this,"_provider");this._injector=t,this._findReplaceController=i,this._contextService=n,this._findReplaceService=r,this._commandService=s,this._init(),this._initCommands()}dispose(){super.dispose(),this._findReplaceController.closePanel(),this._provider.dispose()}_init(){const t=this._injector.createInstance(P);this._provider=t,this.disposeWithMe(this._findReplaceService.registerFindReplaceProvider(t)),this.disposeWithMe(this._contextService.subscribeContextValue$(a.EDITOR_ACTIVATED).pipe(R.filter(i=>!!i)).subscribe(()=>this._findReplaceController.closePanel()))}_initCommands(){[F].forEach(t=>this.disposeWithMe(this._commandService.registerCommand(t)))}},_.SheetsFindReplaceController=U([C(0,a.Inject(a.Injector)),C(1,a.Inject(S.FindReplaceController)),C(2,a.IContextService),C(3,S.IFindReplaceService),C(4,a.ICommandService)],_.SheetsFindReplaceController);const z="sheets-find-replace-provider",J=1e4;let x=class extends S.FindModel{constructor(e,t,i,n,r,s,o,c){super();m(this,"_matchesUpdate$",new R.Subject);m(this,"matchesUpdate$",this._matchesUpdate$.asObservable());m(this,"_activelyChangingMatch$",new R.Subject);m(this,"activelyChangingMatch$",this._activelyChangingMatch$.asObservable());m(this,"_matchesByWorksheet",new Map);m(this,"_matches",[]);m(this,"_matchesPosition",0);m(this,"_activeHighlightIndex",-1);m(this,"_highlightShapes",[]);m(this,"_currentHighlightShape",null);m(this,"_query",null);m(this,"_workbookSelections");this._workbook=e,this._sheetSkeletonManagerService=t,this._univerInstanceService=i,this._renderManagerService=n,this._commandService=r,this._contextService=s,this._themeService=o,this._workbookSelections=c.getWorkbookSelections(this.unitId)}get _matchesCount(){return this._matches.length}get unitId(){return this._workbook.getUnitId()}get matchesCount(){return this._matchesCount}get matchesPosition(){return this._matchesPosition}get currentMatch(){return this._matchesPosition>0?this._matches[this._matchesPosition-1]:null}dispose(){super.dispose(),this._disposeHighlights(),this._toggleDisplayRawFormula(!1)}getMatches(){return this._matches}start(e){switch(this._query=e,e.findBy===S.FindBy.FORMULA?this._toggleDisplayRawFormula(!0):this._toggleDisplayRawFormula(!1),e.findScope){case S.FindScope.UNIT:this.findInWorkbook(e);break;case S.FindScope.SUBUNIT:default:this.findInActiveWorksheet(e);break}}focusSelection(){const e=this.currentMatch;e&&this._commandService.executeCommand(p.SelectRangeCommand.id,{unitId:e.unitId,subUnit:e.range.subUnitId,range:e.range.range})}_toggleDisplayRawFormula(e){this._contextService.setContextValue(w.RENDER_RAW_FORMULA_KEY,e)}findInWorkbook(e){const t=this._workbook.getUnitId();let i,n=!0;const r=()=>{const s=this._workbook.getSheets().filter(o=>!o.isSheetHidden()).map(o=>{const c=this._findInWorksheet(o,e,t),d=o.getSheetId(),{results:l}=c;return l.length?this._matchesByWorksheet.set(d,c.results):this._matchesByWorksheet.delete(d),c});this._matches=s.map(o=>o.results).flat(),this._updateFindHighlight(),n?(i={results:this._matches},n=!1):this._matchesUpdate$.next(this._matches)};return this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe(()=>{this._updateFindHighlight(),this._updateCurrentHighlightShape(this._activeHighlightIndex)})),this.disposeWithMe(a.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(R.filter(([s,o])=>s.id===p.SetWorksheetActiveOperation.id&&!(o!=null&&o.fromFindReplace))).subscribe(()=>{const s=this._workbook.getActiveSheet();if(!s)return;const o=s.getSheetId();this._matchesByWorksheet.has(o)&&this._findNextMatchOnActiveSheetChange(s)})),this.disposeWithMe(a.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(R.filter(([s])=>s.type===a.CommandType.MUTATION&&s.params.unitId===this._workbook.getUnitId()),R.throttleTime(600,void 0,{leading:!1,trailing:!0})).subscribe(()=>r())),r(),i}_findNextMatchOnActiveSheetChange(e){let t,i,n=0;const r=this._matchesByWorksheet.get(e.getSheetId()),s=this._workbookSelections.getCurrentSelections();s!=null&&s.length?([t,n]=this._findNextMatchByRange(r,s[0].range),i=r.findIndex(o=>o===t)):(t=r[0],i=0,n=this._matches.findIndex(o=>o===t)),this._matchesPosition=n+1,this._activelyChangingMatch$.next(t),this._activeHighlightIndex=i,this._updateFindHighlight(),this._updateCurrentHighlightShape(i)}findInActiveWorksheet(e){const t=this._workbook.getUnitId(),i=()=>{var u;const c=this._workbook.getActiveSheet();if(!c)return!1;const d=this._workbookSelections.getCurrentSelections();return(u=d==null?void 0:d.some(g=>!Q(g,c)))!=null?u:!1};let n,r=!0,s=!1;const o=()=>{const c=this._workbook.getActiveSheet();if(!c)return{results:[]};const d=this.currentMatch;s=i();const l=this._workbookSelections.getCurrentSelections(),u=s?this._findInSelections(c,l,e,t):this._findInWorksheet(c,e,t);return this._matches=u.results,this._matchesPosition=this._tryRestoreLastMatchesPosition(d,this._matches),r?(n=u,r=!1):this._matchesUpdate$.next(this._matches),this._updateFindHighlight(),u};return this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe(()=>this._updateFindHighlight())),this.disposeWithMe(R.merge(a.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(R.filter(([c])=>{if(c.type===a.CommandType.MUTATION&&c.params.unitId===this._workbook.getUnitId())return!0;if(c.id===p.SetSelectionsOperation.id&&c.params.unitId===t){const d=i();return d===!1&&s===!1?!1:(s=d,!0)}return!1})),this._workbook.activeSheet$.pipe(R.skip(1))).pipe(R.debounceTime(200)).subscribe(()=>o())),o(),n}_findInRange(e,t,i,n,r){const s=[],o=e.getSheetId(),c=(t.findDirection===S.FindDirection.COLUMN?e.iterateByColumn:e.iterateByRow).bind(e)(i);for(const d of c){const{row:l,col:u,colSpan:g,rowSpan:v,value:I}=d;if(r!=null&&r(l,u)||!I||e.getRowFiltered(l))continue;const{hit:k,replaceable:y,isFormula:b}=Z(e,l,u,t,I);if(k){const W={provider:z,unitId:n,replaceable:y,isFormula:b,range:{subUnitId:o,range:{startRow:l,startColumn:u,endColumn:u+(g!=null?g:1)-1,endRow:l+(v!=null?v:1)-1}}};s.push(W)}}return{results:s}}_findInSelections(e,t,i,n){const{findDirection:r}=i,s=r===S.FindDirection.ROW?H:E,o=new Set;return{results:t.map(d=>this._findInRange(e,i,d.range,n,(l,u)=>{const g=`${l}-${u}`;return o.has(g)?!0:(o.add(g),!1)}).results).flat().sort((d,l)=>s(d.range.range,l.range.range)?-1:1)}}_findInWorksheet(e,t,i){const n=e.getRowCount(),r=e.getColumnCount(),s={startRow:0,startColumn:0,endRow:n-1,endColumn:r-1};return this._findInRange(e,t,s,i)}_disposeHighlights(){var e;this._highlightShapes.forEach(t=>{var i;(i=t.getScene())==null||i.makeDirty(),t.dispose()}),this._highlightShapes=[],(e=this._currentHighlightShape)==null||e.dispose(),this._currentHighlightShape=null}_updateFindHighlight(){var u;this._disposeHighlights();const e=(u=this._sheetSkeletonManagerService.getCurrent())==null?void 0:u.skeleton;if(!e)return;const t=this._workbook.getUnitId(),i=this._renderManagerService.getRenderById(t);if(i==null)return;const{scene:n}=i,r=this._matches,s=this._themeService.getColorFromTheme("yellow.400"),o=new a.ColorKit(s).toRgb(),c=this._workbook.getActiveSheet();if(!c)return;const d=c.getSheetId(),l=r.filter(g=>g.range.subUnitId===d).map((g,v)=>{const{startColumn:I,startRow:k,endColumn:y,endRow:b}=g.range.range,W=M.getCoordByCell(k,I,n,e),ce=M.getCoordByCell(b,y,n,e),{startX:j,startY:$}=W,{endX:ae,endY:le}=ce,L=!c.getRowRawVisible(k),V=!c.getColVisible(I),de=L||V,ue=V?2:ae-j,ge=L?2:le-$,_e={left:j,top:$,color:o,width:ue,height:ge,evented:!1,inHiddenRange:de,zIndex:J};return new Y(`find-highlight-${v}`,_e)});n.addObjects(l),this._highlightShapes=l,n.makeDirty()}_updateCurrentHighlightShape(e){var t;if((t=this._currentHighlightShape)==null||t.setShapeProps({activated:!1}),this._currentHighlightShape=null,e!==void 0){const i=this._highlightShapes[e];if(!i)return;this._currentHighlightShape=i,i.setShapeProps({activated:!0})}}_getSheetObject(){return M.getSheetObject(this._univerInstanceService,this._renderManagerService)}_focusMatch(e){var i;const t=e.range.subUnitId;t!==((i=this._workbook.getActiveSheet())==null?void 0:i.getSheetId())&&this._commandService.executeCommand(p.SetWorksheetActivateCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:t},{fromFindReplace:!0}),this._commandService.executeCommand(M.ScrollToCellCommand.id,{range:e.range.range},{fromFindReplace:!0})}_tryRestoreLastMatchesPosition(e,t){if(!e)return 0;const{subUnitId:i}=e.range,{startColumn:n,startRow:r}=e.range.range,s=t.findIndex(o=>{if(i!==o.range.subUnitId)return!1;const{startColumn:c,startRow:d}=o.range.range;return c===n&&d===r});return s>-1?s+1:0}moveToNextMatch(e){var o,c,d,l,u;if(!this._matches.length)return null;const t=(o=e==null?void 0:e.loop)!=null?o:!1,i=(c=e==null?void 0:e.stayIfOnMatch)!=null?c:!1,n=(d=e==null?void 0:e.noFocus)!=null?d:!1,r=(l=e==null?void 0:e.ignoreSelection)!=null?l:!1,s=this._findNextMatch(t,i,r);if(s){const[g,v]=s;return this._matchesPosition=v+1,this._query.findScope===S.FindScope.UNIT?this._activeHighlightIndex=this._matchesByWorksheet.get(g.range.subUnitId).findIndex(I=>I===g):this._activeHighlightIndex=v,n||this._focusMatch(g),((u=this._workbook.getActiveSheet())==null?void 0:u.getSheetId())===g.range.subUnitId&&this._updateCurrentHighlightShape(this._activeHighlightIndex),g}return this._matchesPosition=0,this._updateCurrentHighlightShape(),null}moveToPreviousMatch(e){var o,c,d,l,u;if(!this._matches.length)return null;const t=(o=e==null?void 0:e.loop)!=null?o:!1,i=(c=e==null?void 0:e.stayIfOnMatch)!=null?c:!1,n=(d=e==null?void 0:e.noFocus)!=null?d:!1,r=(l=e==null?void 0:e.ignoreSelection)!=null?l:!1,s=this._findPreviousMatch(t,i,r);if(s){const[g,v]=s;return this._matchesPosition=v+1,this._query.findScope===S.FindScope.UNIT?this._activeHighlightIndex=this._matchesByWorksheet.get(g.range.subUnitId).findIndex(I=>I===g):this._activeHighlightIndex=v,n||this._focusMatch(g),((u=this._workbook.getActiveSheet())==null?void 0:u.getSheetId())===g.range.subUnitId&&this._updateCurrentHighlightShape(this._activeHighlightIndex),g}return this._matchesPosition=0,this._updateCurrentHighlightShape(),null}_findPreviousMatch(e=!1,t=!1,i=!1){var o;if(this.currentMatch){const c=this._matches.findIndex(g=>g===this.currentMatch);if(t)return[this.currentMatch,c];const d=c-1;if(!e&&d<0)return null;const l=this._matches.length,u=(d+l)%l;return[this._matches[u],u]}const n=this._workbookSelections.getCurrentLastSelection();if(i||!n){const c=this._matches.length-1;return[this._matches[c],c]}if(this._query.findScope!==S.FindScope.UNIT)return this._findPreviousMatchByRange(this._matches,n.range);const r=(o=this._workbook.getActiveSheet())==null?void 0:o.getSheetId();if(!r)return null;const s=this._findPreviousWorksheetThatHasAMatch(r,e);return s?this._findPreviousMatchByRange(this._matchesByWorksheet.get(s),n.range):null}_findNextMatch(e=!1,t=!1,i=!1){var o;if(this.currentMatch){const c=this._matches.findIndex(g=>g===this.currentMatch);if(t)return[this.currentMatch,c];const d=c+1,l=this._matches.length;if(!e&&d>=l)return null;const u=d%l;return[this._matches[u],u]}const n=this._workbookSelections.getCurrentLastSelection();if(i||!n)return[this._matches[0],0];if(this._query.findScope!==S.FindScope.UNIT)return this._findNextMatchByRange(this._matches,n.range,t);const r=(o=this._workbook.getActiveSheet())==null?void 0:o.getSheetId();if(!r)return null;const s=this._findNextWorksheetThatHasAMatch(r,e);return s?this._findNextMatchByRange(this._matchesByWorksheet.get(s),n.range):null}_findPreviousWorksheetThatHasAMatch(e,t=!1){const i=this._workbook.getSheetOrders(),n=i.findIndex(o=>o===e),s=(t?a.rotate(i,n+1):i.slice(0,n+1)).findLast(o=>this._matchesByWorksheet.has(o));return s!=null?s:null}_findNextWorksheetThatHasAMatch(e,t=!1){const i=this._workbook.getSheetOrders(),n=i.findIndex(o=>o===e),s=(t?a.rotate(i,n):i.slice(n)).find(o=>this._matchesByWorksheet.has(o));return s!=null?s:null}_findNextMatchByRange(e,t,i=!1){const n=this._query.findDirection===S.FindDirection.ROW;let r=e.findIndex(o=>{const c=o.range.range;if(!(n?H(t,c):E(t,c)))return!1;const l=T(t,c);return i?l:!l});r===-1&&(r=e.length-1);const s=e[r];return[s,this._matches.findIndex(o=>o===s)]}_findPreviousMatchByRange(e,t,i=!1){const n=this._query.findDirection===S.FindDirection.ROW;let r=this._matches.findLastIndex(o=>{const c=o.range.range;if(!(n?q(t,c):K(t,c)))return!1;const l=T(t,c);return i?l:!l});r===-1&&(r=0);const s=e[r];return[s,this._matches.findIndex(o=>o===s)]}async replace(e){if(this._matchesCount===0||!this.currentMatch||!this._query||!this.currentMatch.replaceable)return!1;const t=this.currentMatch.range,i=this._workbook.getSheetBySheetId(this.currentMatch.range.subUnitId),n=this._getReplacedCellData(this.currentMatch,i,this._query.findBy===S.FindBy.FORMULA,this._query.findString,e,this._query.caseSensitive?"g":"ig"),r={unitId:this.currentMatch.unitId,subUnitId:t.subUnitId,value:{[t.range.startRow]:{[t.range.startColumn]:n}}};return this._commandService.executeCommand(p.SetRangeValuesCommand.id,r)}async replaceAll(e){if(this._matchesCount===0||!this._query)return{success:0,failure:0};const t=this._workbook.getUnitId(),{findString:i,caseSensitive:n,findBy:r}=this._query,s=r===S.FindBy.FORMULA,o=n?"g":"ig",c=[];return a.groupBy(this._matches.filter(l=>l.replaceable),l=>l.range.subUnitId).forEach((l,u)=>{const g=new a.ObjectMatrix,v=this._workbook.getSheetBySheetId(u);l.forEach(I=>{const{startColumn:k,startRow:y}=I.range.range,b=this._getReplacedCellData(I,v,s,i,e,o);b&&g.setValue(y,k,b)}),c.push({count:l.length,subUnitId:u,value:g.getMatrix()})}),c?this._commandService.executeCommand(F.id,{unitId:t,replacements:c}):{success:0,failure:0}}_getReplacedCellData(e,t,i,n,r,s){var v;const o=e.range.range,{startRow:c,startColumn:d}=o,l=t.getCellRaw(c,d);if(e.isFormula)return i?{f:l.f.replace(new RegExp(O(n),s),r),v:null}:null;if(!!((v=l.p)!=null&&v.body)){const I=a.Tools.deepClone(l.p);return a.replaceInDocumentBody(I.body,n,r,this._query.caseSensitive),{p:I}}return{v:l.v.toString().replace(new RegExp(O(n),s),r)}}};x=U([C(2,a.IUniverInstanceService),C(3,w.IRenderManagerService),C(4,a.ICommandService),C(5,a.IContextService),C(6,a.Inject(a.ThemeService)),C(7,a.Inject(p.SheetsSelectionsService))],x);function O(h){return h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}let P=class extends a.Disposable{constructor(e,t,i){super();m(this,"_findModelsByUnitId",new Map);this._univerInstanceService=e,this._renderManagerService=t,this._injector=i}async find(e){this._terminate();const t=this._univerInstanceService.getAllUnitsForType(a.UniverInstanceType.UNIVER_SHEET),i=this._preprocessQuery(e);return t.map(r=>{const s=this._renderManagerService.getRenderById(r.getUnitId()).with(M.SheetSkeletonManagerService),o=this._injector.createInstance(x,r,s);return this._findModelsByUnitId.set(r.getUnitId(),o),o.start(i),o})}terminate(){this._terminate()}_terminate(){this._findModelsByUnitId.forEach(e=>e.dispose()),this._findModelsByUnitId.clear()}_preprocessQuery(e){let t=e.caseSensitive?e.findString:e.findString.toLowerCase();return t=t.trim(),{...e,findString:t}}};P=U([C(0,a.IUniverInstanceService),C(1,w.IRenderManagerService),C(2,a.Inject(a.Injector))],P);const f={hit:!1,replaceable:!1,isFormula:!1,rawData:null};function Z(h,e,t,i,n){const{findBy:r}=i,s=r===S.FindBy.FORMULA,o=h.getCellRaw(e,t);return f.rawData=o,!(o!=null&&o.f)?(f.isFormula=!1,B(n,i)?o?(f.hit=!0,f.replaceable=!0):(f.hit=!0,f.replaceable=!1):(f.hit=!1,f.replaceable=!1),f):(f.isFormula=!0,s?B({v:o.f},i)?(f.hit=!0,f.replaceable=!0,f):(f.hit=!1,f.replaceable=!1,f):(f.replaceable=!1,B(n,i)?f.hit=!0:f.hit=!1,f))}function B(h,e){let t=ee(h);return t?e.matchesTheWholeCell?(t=te(t),e.caseSensitive?t===e.findString:t.toLowerCase()===e.findString):e.caseSensitive?t.indexOf(e.findString)>-1:t.toLowerCase().indexOf(e.findString)>-1:!1}function ee(h){var t,i,n;const e=(n=(i=(t=h==null?void 0:h.p)==null?void 0:t.body)==null?void 0:i.dataStream)!=null?n:h==null?void 0:h.v;return typeof e=="number"?`${e}`:typeof e=="boolean"?e?"1":"0":e}function te(h){return h.replace(/^ +/g,"").replace(/ +$/g,"")}const ie="sheets-find-replace.config",A={};var ne=Object.defineProperty,se=Object.getOwnPropertyDescriptor,re=(h,e,t)=>e in h?ne(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t,oe=(h,e,t,i)=>{for(var n=i>1?void 0:i?se(e,t):e,r=h.length-1,s;r>=0;r--)(s=h[r])&&(n=s(n)||n);return n},D=(h,e)=>(t,i)=>e(t,i,h),N=(h,e,t)=>re(h,typeof e!="symbol"?e+"":e,t);const he="SHEET_FIND_REPLACE_PLUGIN";_.UniverSheetsFindReplacePlugin=class extends a.Plugin{constructor(e=A,t,i){super(),this._config=e,this._injector=t,this._configService=i;const{...n}=a.merge({},A,this._config);this._configService.setConfig(ie,n)}onStarting(){[[_.SheetsFindReplaceController]].forEach(e=>this._injector.add(e))}onSteady(){this._injector.get(_.SheetsFindReplaceController)}},N(_.UniverSheetsFindReplacePlugin,"pluginName",he),N(_.UniverSheetsFindReplacePlugin,"type",a.UniverInstanceType.UNIVER_SHEET),_.UniverSheetsFindReplacePlugin=oe([a.DependentOn(p.UniverSheetsPlugin,p.UniverSheetsPlugin,S.UniverFindReplacePlugin),D(1,a.Inject(a.Injector)),D(2,a.IConfigService)],_.UniverSheetsFindReplacePlugin),_.SheetReplaceCommand=F,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
|
6
|
+
(function(_,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-render"),require("@univerjs/find-replace"),require("@univerjs/sheets-ui"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-render","@univerjs/find-replace","@univerjs/sheets-ui","rxjs"],a):(_=typeof globalThis<"u"?globalThis:_||self,a(_.UniverSheetsFindReplace={},_.UniverCore,_.UniverSheets,_.UniverEngineRender,_.UniverFindReplace,_.UniverSheetsUi,_.rxjs))})(this,(function(_,a,p,b,S,M,k){"use strict";var fe=Object.defineProperty;var Se=(_,a,p)=>a in _?fe(_,a,{enumerable:!0,configurable:!0,writable:!0,value:p}):_[a]=p;var m=(_,a,p)=>Se(_,typeof a!="symbol"?a+"":a,p);const F={id:"sheet.command.replace",type:a.CommandType.COMMAND,handler:async(h,e)=>{const t=h.get(a.IUndoRedoService),i=h.get(a.ICommandService),{unitId:n,replacements:r}=e,s=t.__tempBatchingUndoRedo(n),o=await Promise.all(r.map(c=>i.executeCommand(p.SetRangeValuesCommand.id,{unitId:n,subUnitId:c.subUnitId,value:c.value})));return s.dispose(),G(o,r)}};function G(h,e){let t=0,i=0;return h.forEach((n,r)=>{const s=e[r].count;n?t+=s:i+=s}),{success:t,failure:i}}class Y extends b.Shape{constructor(t,i){super(t,i);m(this,"_activated",!1);m(this,"_inHiddenRange",!1);m(this,"_color");i&&this.setShapeProps(i)}setShapeProps(t){this._activated=!!t.activated,typeof t.inHiddenRange<"u"&&(this._inHiddenRange=t.inHiddenRange),typeof t.color<"u"&&(this._color=t.color),this.transformByState({width:t.width,height:t.height})}_draw(t){const i=this._activated,n=`rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, 0.35)`,r=`rgb(${this._color.r}, ${this._color.g}, ${this._color.b})`;b.Rect.drawWith(t,{width:this.width,height:this.height,fill:n,stroke:i?r:void 0,strokeWidth:i?2:0,evented:!1})}}function T(h,e){return h.startRow===e.startRow&&h.startColumn===e.startColumn}function H(h,e){return h.startRow<e.startRow||h.startRow===e.startRow&&h.startColumn<=e.startColumn}function E(h,e){return h.startColumn<e.startColumn||h.startColumn===e.startColumn&&h.startRow<=e.startRow}function q(h,e){return h.startRow>e.startRow||h.startRow===e.startRow&&h.startColumn>=e.startColumn}function K(h,e){return h.startColumn>e.startColumn||h.startColumn===e.startColumn&&h.startRow>=e.startRow}function Q(h,e){const{range:t}=h,{startRow:i,startColumn:n}=t,r=e.getMergedCell(i,n);return r?a.Rectangle.equals(t,r):t.endRow===t.startRow&&t.endColumn===t.startColumn}var X=Object.getOwnPropertyDescriptor,U=(h,e,t,i)=>{for(var n=i>1?void 0:i?X(e,t):e,r=h.length-1,s;r>=0;r--)(s=h[r])&&(n=s(n)||n);return n},C=(h,e)=>(t,i)=>e(t,i,h);_.SheetsFindReplaceController=class extends a.Disposable{constructor(t,i,n,r,s){super();m(this,"_provider");this._injector=t,this._findReplaceController=i,this._contextService=n,this._findReplaceService=r,this._commandService=s,this._init(),this._initCommands()}dispose(){super.dispose(),this._findReplaceController.closePanel(),this._provider.dispose()}_init(){const t=this._injector.createInstance(P);this._provider=t,this.disposeWithMe(this._findReplaceService.registerFindReplaceProvider(t)),this.disposeWithMe(this._contextService.subscribeContextValue$(a.EDITOR_ACTIVATED).pipe(k.filter(i=>!!i)).subscribe(()=>this._findReplaceController.closePanel()))}_initCommands(){[F].forEach(t=>this.disposeWithMe(this._commandService.registerCommand(t)))}},_.SheetsFindReplaceController=U([C(0,a.Inject(a.Injector)),C(1,a.Inject(S.FindReplaceController)),C(2,a.IContextService),C(3,S.IFindReplaceService),C(4,a.ICommandService)],_.SheetsFindReplaceController);const z="sheets-find-replace-provider",J=1e4;let x=class extends S.FindModel{constructor(e,t,i,n,r,s,o,c){super();m(this,"_matchesUpdate$",new k.Subject);m(this,"matchesUpdate$",this._matchesUpdate$.asObservable());m(this,"_activelyChangingMatch$",new k.Subject);m(this,"activelyChangingMatch$",this._activelyChangingMatch$.asObservable());m(this,"_matchesByWorksheet",new Map);m(this,"_matches",[]);m(this,"_matchesPosition",0);m(this,"_activeHighlightIndex",-1);m(this,"_highlightShapes",[]);m(this,"_currentHighlightShape",null);m(this,"_query",null);m(this,"_workbookSelections");this._workbook=e,this._sheetSkeletonManagerService=t,this._univerInstanceService=i,this._renderManagerService=n,this._commandService=r,this._contextService=s,this._themeService=o,this._workbookSelections=c.getWorkbookSelections(this.unitId)}get _matchesCount(){return this._matches.length}get unitId(){return this._workbook.getUnitId()}get matchesCount(){return this._matchesCount}get matchesPosition(){return this._matchesPosition}get currentMatch(){return this._matchesPosition>0?this._matches[this._matchesPosition-1]:null}dispose(){super.dispose(),this._disposeHighlights(),this._toggleDisplayRawFormula(!1)}getMatches(){return this._matches}start(e){switch(this._query=e,e.findBy===S.FindBy.FORMULA?this._toggleDisplayRawFormula(!0):this._toggleDisplayRawFormula(!1),e.findScope){case S.FindScope.UNIT:this.findInWorkbook(e);break;case S.FindScope.SUBUNIT:default:this.findInActiveWorksheet(e);break}}focusSelection(){const e=this.currentMatch;e&&this._commandService.executeCommand(p.SelectRangeCommand.id,{unitId:e.unitId,subUnit:e.range.subUnitId,range:e.range.range})}_toggleDisplayRawFormula(e){this._contextService.setContextValue(b.RENDER_RAW_FORMULA_KEY,e)}findInWorkbook(e){const t=this._workbook.getUnitId();let i,n=!0;const r=()=>{const s=this._workbook.getSheets().filter(o=>!o.isSheetHidden()).map(o=>{const c=this._findInWorksheet(o,e,t),d=o.getSheetId(),{results:l}=c;return l.length?this._matchesByWorksheet.set(d,c.results):this._matchesByWorksheet.delete(d),c});this._matches=s.map(o=>o.results).flat(),this._updateFindHighlight(),n?(i={results:this._matches},n=!1):this._matchesUpdate$.next(this._matches)};return this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe(()=>{this._updateFindHighlight(),this._updateCurrentHighlightShape(this._activeHighlightIndex)})),this.disposeWithMe(a.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(k.filter(([s,o])=>s.id===p.SetWorksheetActiveOperation.id&&!(o!=null&&o.fromFindReplace))).subscribe(()=>{const s=this._workbook.getActiveSheet();if(!s)return;const o=s.getSheetId();this._matchesByWorksheet.has(o)&&this._findNextMatchOnActiveSheetChange(s)})),this.disposeWithMe(a.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(k.filter(([s])=>s.type===a.CommandType.MUTATION&&s.params.unitId===this._workbook.getUnitId()),k.throttleTime(600,void 0,{leading:!1,trailing:!0})).subscribe(()=>r())),r(),i}_findNextMatchOnActiveSheetChange(e){let t,i,n=0;const r=this._matchesByWorksheet.get(e.getSheetId()),s=this._workbookSelections.getCurrentSelections();s!=null&&s.length?([t,n]=this._findNextMatchByRange(r,s[0].range),i=r.findIndex(o=>o===t)):(t=r[0],i=0,n=this._matches.findIndex(o=>o===t)),this._matchesPosition=n+1,this._activelyChangingMatch$.next(t),this._activeHighlightIndex=i,this._updateFindHighlight(),this._updateCurrentHighlightShape(i)}findInActiveWorksheet(e){const t=this._workbook.getUnitId(),i=()=>{var u;const c=this._workbook.getActiveSheet();if(!c)return!1;const d=this._workbookSelections.getCurrentSelections();return(u=d==null?void 0:d.some(g=>!Q(g,c)))!=null?u:!1};let n,r=!0,s=!1;const o=()=>{const c=this._workbook.getActiveSheet();if(!c)return{results:[]};const d=this.currentMatch;s=i();const l=this._workbookSelections.getCurrentSelections(),u=s?this._findInSelections(c,l,e,t):this._findInWorksheet(c,e,t);return this._matches=u.results,this._matchesPosition=this._tryRestoreLastMatchesPosition(d,this._matches),r?(n=u,r=!1):this._matchesUpdate$.next(this._matches),this._updateFindHighlight(),u};return this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe(()=>this._updateFindHighlight())),this.disposeWithMe(k.merge(a.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(k.filter(([c])=>{if(c.type===a.CommandType.MUTATION&&c.params.unitId===this._workbook.getUnitId())return!0;if(c.id===p.SetSelectionsOperation.id&&c.params.unitId===t){const d=i();return d===!1&&s===!1?!1:(s=d,!0)}return!1})),this._workbook.activeSheet$.pipe(k.skip(1))).pipe(k.debounceTime(200)).subscribe(()=>o())),o(),n}_findInRange(e,t,i,n,r){const s=[],o=e.getSheetId(),c=(t.findDirection===S.FindDirection.COLUMN?e.iterateByColumn:e.iterateByRow).bind(e)(i);for(const d of c){const{row:l,col:u,colSpan:g,rowSpan:v,value:I}=d;if(r!=null&&r(l,u)||!I||e.getRowFiltered(l))continue;const{hit:R,replaceable:y,isFormula:w}=Z(e,l,u,t,I);if(R){const W={provider:z,unitId:n,replaceable:y,isFormula:w,range:{subUnitId:o,range:{startRow:l,startColumn:u,endColumn:u+(g!=null?g:1)-1,endRow:l+(v!=null?v:1)-1}}};s.push(W)}}return{results:s}}_findInSelections(e,t,i,n){const{findDirection:r}=i,s=r===S.FindDirection.ROW?H:E,o=new Set;return{results:t.map(d=>this._findInRange(e,i,d.range,n,(l,u)=>{const g=`${l}-${u}`;return o.has(g)?!0:(o.add(g),!1)}).results).flat().sort((d,l)=>s(d.range.range,l.range.range)?-1:1)}}_findInWorksheet(e,t,i){const n=e.getRowCount(),r=e.getColumnCount(),s={startRow:0,startColumn:0,endRow:n-1,endColumn:r-1};return this._findInRange(e,t,s,i)}_disposeHighlights(){var e;this._highlightShapes.forEach(t=>{var i;(i=t.getScene())==null||i.makeDirty(),t.dispose()}),this._highlightShapes=[],(e=this._currentHighlightShape)==null||e.dispose(),this._currentHighlightShape=null}_updateFindHighlight(){var u;this._disposeHighlights();const e=(u=this._sheetSkeletonManagerService.getCurrent())==null?void 0:u.skeleton;if(!e)return;const t=this._workbook.getUnitId(),i=this._renderManagerService.getRenderById(t);if(i==null)return;const{scene:n}=i,r=this._matches,s=this._themeService.getColorFromTheme("yellow.400"),o=new a.ColorKit(s).toRgb(),c=this._workbook.getActiveSheet();if(!c)return;const d=c.getSheetId(),l=r.filter(g=>g.range.subUnitId===d).map((g,v)=>{const{startColumn:I,startRow:R,endColumn:y,endRow:w}=g.range.range,W=M.getCoordByCell(R,I,n,e),ce=M.getCoordByCell(w,y,n,e),{startX:j,startY:$}=W,{endX:ae,endY:le}=ce,L=!c.getRowRawVisible(R),V=!c.getColVisible(I),de=L||V,ue=V?2:ae-j,ge=L?2:le-$,_e={left:j,top:$,color:o,width:ue,height:ge,evented:!1,inHiddenRange:de,zIndex:J};return new Y(`find-highlight-${v}`,_e)});n.addObjects(l),this._highlightShapes=l,n.makeDirty()}_updateCurrentHighlightShape(e){var t;if((t=this._currentHighlightShape)==null||t.setShapeProps({activated:!1}),this._currentHighlightShape=null,e!==void 0){const i=this._highlightShapes[e];if(!i)return;this._currentHighlightShape=i,i.setShapeProps({activated:!0})}}_getSheetObject(){return M.getSheetObject(this._univerInstanceService,this._renderManagerService)}_focusMatch(e){var i;const t=e.range.subUnitId;t!==((i=this._workbook.getActiveSheet())==null?void 0:i.getSheetId())&&this._commandService.executeCommand(p.SetWorksheetActivateCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:t},{fromFindReplace:!0}),this._commandService.executeCommand(M.ScrollToCellCommand.id,{range:e.range.range},{fromFindReplace:!0})}_tryRestoreLastMatchesPosition(e,t){if(!e)return 0;const{subUnitId:i}=e.range,{startColumn:n,startRow:r}=e.range.range,s=t.findIndex(o=>{if(i!==o.range.subUnitId)return!1;const{startColumn:c,startRow:d}=o.range.range;return c===n&&d===r});return s>-1?s+1:0}moveToNextMatch(e){var o,c,d,l,u;if(!this._matches.length)return null;const t=(o=e==null?void 0:e.loop)!=null?o:!1,i=(c=e==null?void 0:e.stayIfOnMatch)!=null?c:!1,n=(d=e==null?void 0:e.noFocus)!=null?d:!1,r=(l=e==null?void 0:e.ignoreSelection)!=null?l:!1,s=this._findNextMatch(t,i,r);if(s){const[g,v]=s;return this._matchesPosition=v+1,this._query.findScope===S.FindScope.UNIT?this._activeHighlightIndex=this._matchesByWorksheet.get(g.range.subUnitId).findIndex(I=>I===g):this._activeHighlightIndex=v,n||this._focusMatch(g),((u=this._workbook.getActiveSheet())==null?void 0:u.getSheetId())===g.range.subUnitId&&this._updateCurrentHighlightShape(this._activeHighlightIndex),g}return this._matchesPosition=0,this._updateCurrentHighlightShape(),null}moveToPreviousMatch(e){var o,c,d,l,u;if(!this._matches.length)return null;const t=(o=e==null?void 0:e.loop)!=null?o:!1,i=(c=e==null?void 0:e.stayIfOnMatch)!=null?c:!1,n=(d=e==null?void 0:e.noFocus)!=null?d:!1,r=(l=e==null?void 0:e.ignoreSelection)!=null?l:!1,s=this._findPreviousMatch(t,i,r);if(s){const[g,v]=s;return this._matchesPosition=v+1,this._query.findScope===S.FindScope.UNIT?this._activeHighlightIndex=this._matchesByWorksheet.get(g.range.subUnitId).findIndex(I=>I===g):this._activeHighlightIndex=v,n||this._focusMatch(g),((u=this._workbook.getActiveSheet())==null?void 0:u.getSheetId())===g.range.subUnitId&&this._updateCurrentHighlightShape(this._activeHighlightIndex),g}return this._matchesPosition=0,this._updateCurrentHighlightShape(),null}_findPreviousMatch(e=!1,t=!1,i=!1){var o;if(this.currentMatch){const c=this._matches.findIndex(g=>g===this.currentMatch);if(t)return[this.currentMatch,c];const d=c-1;if(!e&&d<0)return null;const l=this._matches.length,u=(d+l)%l;return[this._matches[u],u]}const n=this._workbookSelections.getCurrentLastSelection();if(i||!n){const c=this._matches.length-1;return[this._matches[c],c]}if(this._query.findScope!==S.FindScope.UNIT)return this._findPreviousMatchByRange(this._matches,n.range);const r=(o=this._workbook.getActiveSheet())==null?void 0:o.getSheetId();if(!r)return null;const s=this._findPreviousWorksheetThatHasAMatch(r,e);return s?this._findPreviousMatchByRange(this._matchesByWorksheet.get(s),n.range):null}_findNextMatch(e=!1,t=!1,i=!1){var o;if(this.currentMatch){const c=this._matches.findIndex(g=>g===this.currentMatch);if(t)return[this.currentMatch,c];const d=c+1,l=this._matches.length;if(!e&&d>=l)return null;const u=d%l;return[this._matches[u],u]}const n=this._workbookSelections.getCurrentLastSelection();if(i||!n)return[this._matches[0],0];if(this._query.findScope!==S.FindScope.UNIT)return this._findNextMatchByRange(this._matches,n.range,t);const r=(o=this._workbook.getActiveSheet())==null?void 0:o.getSheetId();if(!r)return null;const s=this._findNextWorksheetThatHasAMatch(r,e);return s?this._findNextMatchByRange(this._matchesByWorksheet.get(s),n.range):null}_findPreviousWorksheetThatHasAMatch(e,t=!1){const i=this._workbook.getSheetOrders(),n=i.findIndex(o=>o===e),s=(t?a.rotate(i,n+1):i.slice(0,n+1)).findLast(o=>this._matchesByWorksheet.has(o));return s!=null?s:null}_findNextWorksheetThatHasAMatch(e,t=!1){const i=this._workbook.getSheetOrders(),n=i.findIndex(o=>o===e),s=(t?a.rotate(i,n):i.slice(n)).find(o=>this._matchesByWorksheet.has(o));return s!=null?s:null}_findNextMatchByRange(e,t,i=!1){const n=this._query.findDirection===S.FindDirection.ROW;let r=e.findIndex(o=>{const c=o.range.range;if(!(n?H(t,c):E(t,c)))return!1;const l=T(t,c);return i?l:!l});r===-1&&(r=e.length-1);const s=e[r];return[s,this._matches.findIndex(o=>o===s)]}_findPreviousMatchByRange(e,t,i=!1){const n=this._query.findDirection===S.FindDirection.ROW;let r=this._matches.findLastIndex(o=>{const c=o.range.range;if(!(n?q(t,c):K(t,c)))return!1;const l=T(t,c);return i?l:!l});r===-1&&(r=0);const s=e[r];return[s,this._matches.findIndex(o=>o===s)]}async replace(e){if(this._matchesCount===0||!this.currentMatch||!this._query||!this.currentMatch.replaceable)return!1;const t=this.currentMatch.range,i=this._workbook.getSheetBySheetId(this.currentMatch.range.subUnitId),n=this._getReplacedCellData(this.currentMatch,i,this._query.findBy===S.FindBy.FORMULA,this._query.findString,e,this._query.caseSensitive?"g":"ig"),r={unitId:this.currentMatch.unitId,subUnitId:t.subUnitId,value:{[t.range.startRow]:{[t.range.startColumn]:n}}};return this._commandService.executeCommand(p.SetRangeValuesCommand.id,r)}async replaceAll(e){if(this._matchesCount===0||!this._query)return{success:0,failure:0};const t=this._workbook.getUnitId(),{findString:i,caseSensitive:n,findBy:r}=this._query,s=r===S.FindBy.FORMULA,o=n?"g":"ig",c=[];return a.groupBy(this._matches.filter(l=>l.replaceable),l=>l.range.subUnitId).forEach((l,u)=>{const g=new a.ObjectMatrix,v=this._workbook.getSheetBySheetId(u);l.forEach(I=>{const{startColumn:R,startRow:y}=I.range.range,w=this._getReplacedCellData(I,v,s,i,e,o);w&&g.setValue(y,R,w)}),c.push({count:l.length,subUnitId:u,value:g.getMatrix()})}),c?this._commandService.executeCommand(F.id,{unitId:t,replacements:c}):{success:0,failure:0}}_getReplacedCellData(e,t,i,n,r,s){var v;const o=e.range.range,{startRow:c,startColumn:d}=o,l=t.getCellRaw(c,d);if(e.isFormula)return i?{f:l.f.replace(new RegExp(O(n),s),r),v:null}:null;if(!!((v=l.p)!=null&&v.body)){const I=a.Tools.deepClone(l.p);return a.replaceInDocumentBody(I.body,n,r,this._query.caseSensitive),{p:I}}return{v:l.v.toString().replace(new RegExp(O(n),s),r)}}};x=U([C(2,a.IUniverInstanceService),C(3,b.IRenderManagerService),C(4,a.ICommandService),C(5,a.IContextService),C(6,a.Inject(a.ThemeService)),C(7,a.Inject(p.SheetsSelectionsService))],x);function O(h){return h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}let P=class extends a.Disposable{constructor(e,t,i){super();m(this,"_findModelsByUnitId",new Map);this._univerInstanceService=e,this._renderManagerService=t,this._injector=i}async find(e){this._terminate();const t=this._univerInstanceService.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return[];const i=this._preprocessQuery(e),n=this._renderManagerService.getRenderById(t.getUnitId()).with(M.SheetSkeletonManagerService),r=this._injector.createInstance(x,t,n);return this._findModelsByUnitId.set(t.getUnitId(),r),r.start(i),[r]}terminate(){this._terminate()}_terminate(){this._findModelsByUnitId.forEach(e=>e.dispose()),this._findModelsByUnitId.clear()}_preprocessQuery(e){let t=e.caseSensitive?e.findString:e.findString.toLowerCase();return t=t.trim(),{...e,findString:t}}};P=U([C(0,a.IUniverInstanceService),C(1,b.IRenderManagerService),C(2,a.Inject(a.Injector))],P);const f={hit:!1,replaceable:!1,isFormula:!1,rawData:null};function Z(h,e,t,i,n){const{findBy:r}=i,s=r===S.FindBy.FORMULA,o=h.getCellRaw(e,t);return f.rawData=o,!(o!=null&&o.f)?(f.isFormula=!1,B(n,i)?o?(f.hit=!0,f.replaceable=!0):(f.hit=!0,f.replaceable=!1):(f.hit=!1,f.replaceable=!1),f):(f.isFormula=!0,s?B({v:o.f},i)?(f.hit=!0,f.replaceable=!0,f):(f.hit=!1,f.replaceable=!1,f):(f.replaceable=!1,B(n,i)?f.hit=!0:f.hit=!1,f))}function B(h,e){let t=ee(h);return t?e.matchesTheWholeCell?(t=te(t),e.caseSensitive?t===e.findString:t.toLowerCase()===e.findString):e.caseSensitive?t.indexOf(e.findString)>-1:t.toLowerCase().indexOf(e.findString)>-1:!1}function ee(h){var t,i,n;const e=(n=(i=(t=h==null?void 0:h.p)==null?void 0:t.body)==null?void 0:i.dataStream)!=null?n:h==null?void 0:h.v;return typeof e=="number"?`${e}`:typeof e=="boolean"?e?"1":"0":e}function te(h){return h.replace(/^ +/g,"").replace(/ +$/g,"")}const ie="sheets-find-replace.config",A={};var ne=Object.defineProperty,se=Object.getOwnPropertyDescriptor,re=(h,e,t)=>e in h?ne(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t,oe=(h,e,t,i)=>{for(var n=i>1?void 0:i?se(e,t):e,r=h.length-1,s;r>=0;r--)(s=h[r])&&(n=s(n)||n);return n},D=(h,e)=>(t,i)=>e(t,i,h),N=(h,e,t)=>re(h,typeof e!="symbol"?e+"":e,t);const he="SHEET_FIND_REPLACE_PLUGIN";_.UniverSheetsFindReplacePlugin=class extends a.Plugin{constructor(e=A,t,i){super(),this._config=e,this._injector=t,this._configService=i;const{...n}=a.merge({},A,this._config);this._configService.setConfig(ie,n)}onStarting(){[[_.SheetsFindReplaceController]].forEach(e=>this._injector.add(e))}onSteady(){this._injector.get(_.SheetsFindReplaceController)}},N(_.UniverSheetsFindReplacePlugin,"pluginName",he),N(_.UniverSheetsFindReplacePlugin,"type",a.UniverInstanceType.UNIVER_SHEET),_.UniverSheetsFindReplacePlugin=oe([a.DependentOn(p.UniverSheetsPlugin,p.UniverSheetsPlugin,S.UniverFindReplacePlugin),D(1,a.Inject(a.Injector)),D(2,a.IConfigService)],_.UniverSheetsFindReplacePlugin),_.SheetReplaceCommand=F,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// @univerjs/sheets-find-replace/facade
|
|
10
|
-
(function(i,n){typeof exports=="object"&&typeof module<"u"?n(require("@univerjs/core"),require("@univerjs/find-replace"),require("@univerjs/sheets/facade"),require("@univerjs/core/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/find-replace","@univerjs/sheets/facade","@univerjs/core/facade"],n):(i=typeof globalThis<"u"?globalThis:i||self,n(i.UniverCore,i.UniverFindReplace,i.UniverSheetsFacade,i.UniverCoreFacade))})(this,function(i,n,c,p){"use strict";var v=Object.defineProperty;var y=(i,n,c)=>n in i?v(i,n,{enumerable:!0,configurable:!0,writable:!0,value:c}):i[n]=c;var l=(i,n,c)=>y(i,typeof n!="symbol"?n+"":n,c);var _=Object.getOwnPropertyDescriptor,f=(o,e,t,s)=>{for(var r=s>1?void 0:s?_(e,t):e,a=o.length-1,h;a>=0;a--)(h=o[a])&&(r=h(r)||r);return r},u=(o,e)=>(t,s)=>e(t,s,o);let d=class extends i.Disposable{constructor(e,t,s,r){super();l(this,"_state",new n.FindReplaceState);l(this,"_model");l(this,"_complete");this._injector=t,this._univerInstanceService=s,this._findReplaceService=r;const a=this._findReplaceService.getProviders();this._model=this._injector.createInstance(n.FindReplaceModel,this._state,a);const h={...n.createInitFindReplaceState(),...e};this._state.changeState(h)}findAll(){return!this._state.findCompleted||!this._complete?[]:this._complete.results.map(e=>this._findMatchToFRange(e))}findNext(){var t;if(!this._state.findCompleted||!this._complete)return null;const e=(t=this._model)==null?void 0:t.moveToNextMatch();return e?this._findMatchToFRange(e):null}findPrevious(){var t;const e=(t=this._model)==null?void 0:t.moveToPreviousMatch();return e?this._findMatchToFRange(e):null}getCurrentMatch(){var t;if(!this._state.findCompleted||!this._complete)throw new Error("Find operation is not completed.");const e=(t=this._model)==null?void 0:t.currentMatch$.value;return e?this._findMatchToFRange(e):null}async matchCaseAsync(e){return this._state.changeState({caseSensitive:e,findCompleted:!1}),new Promise(t=>{const s=this._state.stateUpdates$.subscribe(async r=>{r.findCompleted===!0&&(s.unsubscribe(),await this.ensureCompleteAsync(),t(this))})})}async matchEntireCellAsync(e){return this._state.changeState({matchesTheWholeCell:e,findCompleted:!1}),new Promise(t=>{const s=this._state.stateUpdates$.subscribe(async r=>{r.findCompleted===!0&&(s.unsubscribe(),await this.ensureCompleteAsync(),t(this))})})}async matchFormulaTextAsync(e){return this._state.changeState({findBy:e?n.FindBy.FORMULA:n.FindBy.VALUE,findCompleted:!1}),new Promise(t=>{const s=this._state.stateUpdates$.subscribe(async r=>{r.findCompleted===!0&&(s.unsubscribe(),await this.ensureCompleteAsync(),t(this))})})}async replaceAllWithAsync(e){var s,r,a;await this._state.changeState({replaceRevealed:!0,replaceString:e});const t=(a=(r=await((s=this._model)==null?void 0:s.replaceAll()))==null?void 0:r.success)!=null?a:0;return this._state.changeState({replaceRevealed:!1}),t}async replaceWithAsync(e){var t;return await this._state.changeState({replaceRevealed:!0,replaceString:e}),await((t=this._model)==null?void 0:t.replace()),this._state.changeState({replaceRevealed:!1}),!0}async ensureCompleteAsync(){var e;this._complete=await((e=this._model)==null?void 0:e.start())}_findMatchToFRange(e){const{unitId:t}=e,{subUnitId:s,range:r}=e.range,a=this._univerInstanceService.getUnit(t),h=a.getSheetBySheetId(s);return this._injector.createInstance(c.FRange,a,h,r)}};d=f([u(1,i.Inject(i.Injector)),u(2,i.IUniverInstanceService),u(3,n.IFindReplaceService)],d);class m extends p.FUniver{async createTextFinderAsync(e){const t={findString:e},s=this._injector.createInstance(d,t);return await s.ensureCompleteAsync(),s}}p.FUniver.extend(m)});
|
|
10
|
+
(function(i,n){typeof exports=="object"&&typeof module<"u"?n(require("@univerjs/core"),require("@univerjs/find-replace"),require("@univerjs/sheets/facade"),require("@univerjs/core/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/find-replace","@univerjs/sheets/facade","@univerjs/core/facade"],n):(i=typeof globalThis<"u"?globalThis:i||self,n(i.UniverCore,i.UniverFindReplace,i.UniverSheetsFacade,i.UniverCoreFacade))})(this,(function(i,n,c,p){"use strict";var v=Object.defineProperty;var y=(i,n,c)=>n in i?v(i,n,{enumerable:!0,configurable:!0,writable:!0,value:c}):i[n]=c;var l=(i,n,c)=>y(i,typeof n!="symbol"?n+"":n,c);var _=Object.getOwnPropertyDescriptor,f=(o,e,t,s)=>{for(var r=s>1?void 0:s?_(e,t):e,a=o.length-1,h;a>=0;a--)(h=o[a])&&(r=h(r)||r);return r},u=(o,e)=>(t,s)=>e(t,s,o);let d=class extends i.Disposable{constructor(e,t,s,r){super();l(this,"_state",new n.FindReplaceState);l(this,"_model");l(this,"_complete");this._injector=t,this._univerInstanceService=s,this._findReplaceService=r;const a=this._findReplaceService.getProviders();this._model=this._injector.createInstance(n.FindReplaceModel,this._state,a);const h={...n.createInitFindReplaceState(),...e};this._state.changeState(h)}findAll(){return!this._state.findCompleted||!this._complete?[]:this._complete.results.map(e=>this._findMatchToFRange(e))}findNext(){var t;if(!this._state.findCompleted||!this._complete)return null;const e=(t=this._model)==null?void 0:t.moveToNextMatch();return e?this._findMatchToFRange(e):null}findPrevious(){var t;const e=(t=this._model)==null?void 0:t.moveToPreviousMatch();return e?this._findMatchToFRange(e):null}getCurrentMatch(){var t;if(!this._state.findCompleted||!this._complete)throw new Error("Find operation is not completed.");const e=(t=this._model)==null?void 0:t.currentMatch$.value;return e?this._findMatchToFRange(e):null}async matchCaseAsync(e){return this._state.changeState({caseSensitive:e,findCompleted:!1}),new Promise(t=>{const s=this._state.stateUpdates$.subscribe(async r=>{r.findCompleted===!0&&(s.unsubscribe(),await this.ensureCompleteAsync(),t(this))})})}async matchEntireCellAsync(e){return this._state.changeState({matchesTheWholeCell:e,findCompleted:!1}),new Promise(t=>{const s=this._state.stateUpdates$.subscribe(async r=>{r.findCompleted===!0&&(s.unsubscribe(),await this.ensureCompleteAsync(),t(this))})})}async matchFormulaTextAsync(e){return this._state.changeState({findBy:e?n.FindBy.FORMULA:n.FindBy.VALUE,findCompleted:!1}),new Promise(t=>{const s=this._state.stateUpdates$.subscribe(async r=>{r.findCompleted===!0&&(s.unsubscribe(),await this.ensureCompleteAsync(),t(this))})})}async replaceAllWithAsync(e){var s,r,a;await this._state.changeState({replaceRevealed:!0,replaceString:e});const t=(a=(r=await((s=this._model)==null?void 0:s.replaceAll()))==null?void 0:r.success)!=null?a:0;return this._state.changeState({replaceRevealed:!1}),t}async replaceWithAsync(e){var t;return await this._state.changeState({replaceRevealed:!0,replaceString:e}),await((t=this._model)==null?void 0:t.replace()),this._state.changeState({replaceRevealed:!1}),!0}async ensureCompleteAsync(){var e;this._complete=await((e=this._model)==null?void 0:e.start())}_findMatchToFRange(e){const{unitId:t}=e,{subUnitId:s,range:r}=e.range,a=this._univerInstanceService.getUnit(t),h=a.getSheetBySheetId(s);return this._injector.createInstance(c.FRange,a,h,r)}};d=f([u(1,i.Inject(i.Injector)),u(2,i.IUniverInstanceService),u(3,n.IFindReplaceService)],d);class m extends p.FUniver{async createTextFinderAsync(e){const t={findString:e},s=this._injector.createInstance(d,t);return await s.ensureCompleteAsync(),s}}p.FUniver.extend(m)}));
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
// index
|
package/lib/umd/locales/ca-ES.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @univerjs/find-replace/locale/ca-ES
|
|
2
|
-
(function(e,a){typeof exports=="object"&&typeof module<"u"?module.exports=a():typeof define=="function"&&define.amd?define(a):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceCaES=a())})(this,function(){"use strict";return{"find-replace":{toolbar:"Cerca i reemplaça",shortcut:{"open-find-dialog":"Obre el diàleg de cerca","open-replace-dialog":"Obre el diàleg de reemplaçament","close-dialog":"Tanca el diàleg de cerca i reemplaça","go-to-next-match":"Ves a la següent coincidència","go-to-previous-match":"Ves a la coincidència anterior","focus-selection":"Focalitza la selecció"},dialog:{title:"Cerca",find:"Cerca",replace:"Reemplaça","replace-all":"Reemplaça-ho tot","case-sensitive":"Distingeix majúscules i minúscules","find-placeholder":"Cerca en aquest full","advanced-finding":"Cerca i reemplaçament avançats","replace-placeholder":"Introdueix el text de reemplaçament","match-the-whole-cell":"Coincideix tota la cel·la","find-direction":{title:"Direcció de cerca",row:"Cerca per fila",column:"Cerca per columna"},"find-scope":{title:"Abast de la cerca","current-sheet":"Full actual",workbook:"Llibre"},"find-by":{title:"Cerca per",value:"Cerca per valor",formula:"Cerca fórmula"},"no-match":"Cerca completada però no s’ha trobat cap coincidència.","no-result":"Sense resultats"},replace:{"all-success":"S’han reemplaçat totes les {0} coincidències","all-failure":"Error en reemplaçar",confirm:{title:"Esteu segur que voleu reemplaçar totes les coincidències?"}}},"find-replace-shortcuts":"Cerca i reemplaça"}});
|
|
2
|
+
(function(e,a){typeof exports=="object"&&typeof module<"u"?module.exports=a():typeof define=="function"&&define.amd?define(a):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceCaES=a())})(this,(function(){"use strict";return{"find-replace":{toolbar:"Cerca i reemplaça",shortcut:{"open-find-dialog":"Obre el diàleg de cerca","open-replace-dialog":"Obre el diàleg de reemplaçament","close-dialog":"Tanca el diàleg de cerca i reemplaça","go-to-next-match":"Ves a la següent coincidència","go-to-previous-match":"Ves a la coincidència anterior","focus-selection":"Focalitza la selecció"},dialog:{title:"Cerca",find:"Cerca",replace:"Reemplaça","replace-all":"Reemplaça-ho tot","case-sensitive":"Distingeix majúscules i minúscules","find-placeholder":"Cerca en aquest full","advanced-finding":"Cerca i reemplaçament avançats","replace-placeholder":"Introdueix el text de reemplaçament","match-the-whole-cell":"Coincideix tota la cel·la","find-direction":{title:"Direcció de cerca",row:"Cerca per fila",column:"Cerca per columna"},"find-scope":{title:"Abast de la cerca","current-sheet":"Full actual",workbook:"Llibre"},"find-by":{title:"Cerca per",value:"Cerca per valor",formula:"Cerca fórmula"},"no-match":"Cerca completada però no s’ha trobat cap coincidència.","no-result":"Sense resultats"},replace:{"all-success":"S’han reemplaçat totes les {0} coincidències","all-failure":"Error en reemplaçar",confirm:{title:"Esteu segur que voleu reemplaçar totes les coincidències?"}}},"find-replace-shortcuts":"Cerca i reemplaça"}}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/sheets-find-replace/locale/ca-ES
|
|
6
|
-
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceCaES=i())})(this,function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"No s’ha pogut substituir algunes cel·les",failure:"No s’ha pogut substituir cap cel·la"}}}});
|
|
6
|
+
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceCaES=i())})(this,(function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"No s’ha pogut substituir algunes cel·les",failure:"No s’ha pogut substituir cap cel·la"}}}}));
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// locale/ca-ES
|
package/lib/umd/locales/en-US.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @univerjs/find-replace/locale/en-US
|
|
2
|
-
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceEnUS=l())})(this,function(){"use strict";return{"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"}});
|
|
2
|
+
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceEnUS=l())})(this,(function(){"use strict";return{"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"}}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/sheets-find-replace/locale/en-US
|
|
6
|
-
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceEnUS=l())})(this,function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"Failed to replace some cells",failure:"Failed to replace all cells"}}}});
|
|
6
|
+
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceEnUS=l())})(this,(function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"Failed to replace some cells",failure:"Failed to replace all cells"}}}}));
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// locale/en-US
|
package/lib/umd/locales/es-ES.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @univerjs/find-replace/locale/es-ES
|
|
2
|
-
(function(e,a){typeof exports=="object"&&typeof module<"u"?module.exports=a():typeof define=="function"&&define.amd?define(a):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceEsES=a())})(this,function(){"use strict";return{"find-replace":{toolbar:"Buscar y reemplazar",shortcut:{"open-find-dialog":"Abrir diálogo de búsqueda","open-replace-dialog":"Abrir diálogo de reemplazo","close-dialog":"Cerrar diálogo de buscar y reemplazar","go-to-next-match":"Ir a la siguiente coincidencia","go-to-previous-match":"Ir a la coincidencia anterior","focus-selection":"Enfocar selección"},dialog:{title:"Buscar",find:"Buscar",replace:"Reemplazar","replace-all":"Reemplazar todo","case-sensitive":"Distinguir mayúsculas y minúsculas","find-placeholder":"Buscar en esta hoja","advanced-finding":"Búsqueda y reemplazo avanzados","replace-placeholder":"Introducir texto de reemplazo","match-the-whole-cell":"Coincidir toda la celda","find-direction":{title:"Dirección de búsqueda",row:"Buscar por fila",column:"Buscar por columna"},"find-scope":{title:"Rango de búsqueda","current-sheet":"Hoja actual",workbook:"Libro"},"find-by":{title:"Buscar por",value:"Buscar por valor",formula:"Buscar fórmula"},"no-match":"Búsqueda completada pero no se encontraron coincidencias.","no-result":"Sin resultados"},replace:{"all-success":"Se reemplazaron las {0} coincidencias","all-failure":"Error al reemplazar",confirm:{title:"¿Está seguro de reemplazar todas las coincidencias?"}}},"find-replace-shortcuts":"Buscar y reemplazar"}});
|
|
2
|
+
(function(e,a){typeof exports=="object"&&typeof module<"u"?module.exports=a():typeof define=="function"&&define.amd?define(a):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceEsES=a())})(this,(function(){"use strict";return{"find-replace":{toolbar:"Buscar y reemplazar",shortcut:{"open-find-dialog":"Abrir diálogo de búsqueda","open-replace-dialog":"Abrir diálogo de reemplazo","close-dialog":"Cerrar diálogo de buscar y reemplazar","go-to-next-match":"Ir a la siguiente coincidencia","go-to-previous-match":"Ir a la coincidencia anterior","focus-selection":"Enfocar selección"},dialog:{title:"Buscar",find:"Buscar",replace:"Reemplazar","replace-all":"Reemplazar todo","case-sensitive":"Distinguir mayúsculas y minúsculas","find-placeholder":"Buscar en esta hoja","advanced-finding":"Búsqueda y reemplazo avanzados","replace-placeholder":"Introducir texto de reemplazo","match-the-whole-cell":"Coincidir toda la celda","find-direction":{title:"Dirección de búsqueda",row:"Buscar por fila",column:"Buscar por columna"},"find-scope":{title:"Rango de búsqueda","current-sheet":"Hoja actual",workbook:"Libro"},"find-by":{title:"Buscar por",value:"Buscar por valor",formula:"Buscar fórmula"},"no-match":"Búsqueda completada pero no se encontraron coincidencias.","no-result":"Sin resultados"},replace:{"all-success":"Se reemplazaron las {0} coincidencias","all-failure":"Error al reemplazar",confirm:{title:"¿Está seguro de reemplazar todas las coincidencias?"}}},"find-replace-shortcuts":"Buscar y reemplazar"}}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/sheets-find-replace/locale/es-ES
|
|
6
|
-
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceEsES=n())})(this,function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"No se pudo reemplazar algunas celdas",failure:"No se pudo reemplazar ninguna celda"}}}});
|
|
6
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceEsES=n())})(this,(function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"No se pudo reemplazar algunas celdas",failure:"No se pudo reemplazar ninguna celda"}}}}));
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// locale/es-ES
|
package/lib/umd/locales/fa-IR.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @univerjs/find-replace/locale/fa-IR
|
|
2
|
-
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceFaIR=l())})(this,function(){"use strict";return{"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":"یافتن و جایگزینی"}});
|
|
2
|
+
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceFaIR=l())})(this,(function(){"use strict";return{"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":"یافتن و جایگزینی"}}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/sheets-find-replace/locale/fa-IR
|
|
6
|
-
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceFaIR=i())})(this,function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"جایگزینی برخی سلولها ناموفق بود",failure:"جایگزینی همه سلولها ناموفق بود"}}}});
|
|
6
|
+
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceFaIR=i())})(this,(function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"جایگزینی برخی سلولها ناموفق بود",failure:"جایگزینی همه سلولها ناموفق بود"}}}}));
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// locale/fa-IR
|
package/lib/umd/locales/fr-FR.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @univerjs/find-replace/locale/fr-FR
|
|
2
|
-
(function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r():typeof define=="function"&&define.amd?define(r):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceFrFR=r())})(this,function(){"use strict";return{"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"}});
|
|
2
|
+
(function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r():typeof define=="function"&&define.amd?define(r):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceFrFR=r())})(this,(function(){"use strict";return{"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"}}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/sheets-find-replace/locale/fr-FR
|
|
6
|
-
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceFrFR=l())})(this,function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"Échec du remplacement de certaines cellules",failure:"Échec du remplacement de toutes les cellules"}}}});
|
|
6
|
+
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceFrFR=l())})(this,(function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"Échec du remplacement de certaines cellules",failure:"Échec du remplacement de toutes les cellules"}}}}));
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// locale/fr-FR
|
package/lib/umd/locales/ko-KR.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @univerjs/find-replace/locale/ko-KR
|
|
2
|
-
(function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o():typeof define=="function"&&define.amd?define(o):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceKoKR=o())})(this,function(){"use strict";return{"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":"찾기 및 바꾸기"}});
|
|
2
|
+
(function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o():typeof define=="function"&&define.amd?define(o):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceKoKR=o())})(this,(function(){"use strict";return{"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":"찾기 및 바꾸기"}}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/sheets-find-replace/locale/ko-KR
|
|
6
|
-
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceKoKR=i())})(this,function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"일부 셀 교체에 실패했습니다",failure:"모든 셀 교체에 실패했습니다"}}}});
|
|
6
|
+
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceKoKR=i())})(this,(function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"일부 셀 교체에 실패했습니다",failure:"모든 셀 교체에 실패했습니다"}}}}));
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// locale/ko-KR
|
package/lib/umd/locales/ru-RU.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @univerjs/find-replace/locale/ru-RU
|
|
2
|
-
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceRuRU=l())})(this,function(){"use strict";return{"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":"Найти и заменить"}});
|
|
2
|
+
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceRuRU=l())})(this,(function(){"use strict";return{"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":"Найти и заменить"}}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/sheets-find-replace/locale/ru-RU
|
|
6
|
-
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceRuRU=i())})(this,function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"Не удалось заменить некоторые ячейки",failure:"Не удалось заменить все ячейки"}}}});
|
|
6
|
+
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceRuRU=i())})(this,(function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"Не удалось заменить некоторые ячейки",failure:"Не удалось заменить все ячейки"}}}}));
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// locale/ru-RU
|
package/lib/umd/locales/vi-VN.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @univerjs/find-replace/locale/vi-VN
|
|
2
|
-
(function(t,e){typeof exports=="object"&&typeof module<"u"?module.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.UniverFindReplaceViVN=e())})(this,function(){"use strict";return{"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ế"}});
|
|
2
|
+
(function(t,e){typeof exports=="object"&&typeof module<"u"?module.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.UniverFindReplaceViVN=e())})(this,(function(){"use strict";return{"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ế"}}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/sheets-find-replace/locale/vi-VN
|
|
6
|
-
(function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceViVN=t())})(this,function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"Thay thế một phần ô thất bại",failure:"Thay thế thất bại"}}}});
|
|
6
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceViVN=t())})(this,(function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"Thay thế một phần ô thất bại",failure:"Thay thế thất bại"}}}}));
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// locale/vi-VN
|
package/lib/umd/locales/zh-CN.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @univerjs/find-replace/locale/zh-CN
|
|
2
|
-
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceZhCN=l())})(this,function(){"use strict";return{"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":"查找替换"}});
|
|
2
|
+
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceZhCN=l())})(this,(function(){"use strict";return{"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":"查找替换"}}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/sheets-find-replace/locale/zh-CN
|
|
6
|
-
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceZhCN=i())})(this,function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"部分单元格替换失败",failure:"替换失败"}}}});
|
|
6
|
+
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceZhCN=i())})(this,(function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"部分单元格替换失败",failure:"替换失败"}}}}));
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// locale/zh-CN
|
package/lib/umd/locales/zh-TW.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @univerjs/find-replace/locale/zh-TW
|
|
2
|
-
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceZhTW=l())})(this,function(){"use strict";return{"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":"尋找替換"}});
|
|
2
|
+
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverFindReplaceZhTW=l())})(this,(function(){"use strict";return{"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":"尋找替換"}}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/sheets-find-replace/locale/zh-TW
|
|
6
|
-
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceZhTW=i())})(this,function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"部分單元格替換失敗",failure:"替換失敗"}}}});
|
|
6
|
+
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFindReplaceZhTW=i())})(this,(function(){"use strict";return{"sheet-find-replace":{replace:{"partial-failure":"部分單元格替換失敗",failure:"替換失敗"}}}}));
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// locale/zh-TW
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/preset-sheets-find-replace",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.5",
|
|
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.
|
|
62
|
-
"@univerjs/sheets-find-replace": "0.10.
|
|
61
|
+
"@univerjs/find-replace": "0.10.5",
|
|
62
|
+
"@univerjs/sheets-find-replace": "0.10.5"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@univerjs/core": "0.10.
|
|
65
|
+
"@univerjs/core": "0.10.5",
|
|
66
66
|
"react": "18.3.1",
|
|
67
67
|
"react-dom": "18.3.1",
|
|
68
68
|
"rxjs": "7.8.2",
|
|
69
69
|
"typescript": "^5.8.3",
|
|
70
|
-
"@univerjs-infra/shared": "0.10.
|
|
70
|
+
"@univerjs-infra/shared": "0.10.5"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"prebuild:preset": "tsx prepare.ts",
|