@univerjs/find-replace 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +2 -2
- package/lib/cjs/locale/fr-FR.js +1 -0
- package/lib/es/index.js +444 -438
- package/lib/es/locale/fr-FR.js +51 -0
- package/lib/types/controllers/config.schema.d.ts +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/locale/fr-FR.d.ts +3 -0
- package/lib/umd/index.js +2 -2
- package/lib/umd/locale/fr-FR.js +1 -0
- package/package.json +13 -11
package/lib/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Oe=Object.defineProperty;var Te=(i,e,n)=>e in i?Oe(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n;var l=(i,e,n)=>Te(i,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),u=require("@univerjs/ui"),g=require("rxjs"),p=require("@univerjs/design"),Pe=require("@univerjs/engine-render"),c=require("react"),Ee="find-replace.config",Ne={};var S=function(){return S=Object.assign||function(i){for(var e,n=1,t=arguments.length;n<t;n++){e=arguments[n];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=e[s])}return i},S.apply(this,arguments)},$e=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 s=0,t=Object.getOwnPropertySymbols(i);s<t.length;s++)e.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(i,t[s])&&(n[t[s]]=i[t[s]]);return n},Y=c.forwardRef(function(i,e){var n=i.icon,t=i.id,s=i.className,r=i.extend,a=$e(i,["icon","id","className","extend"]),h="univerjs-icon univerjs-icon-".concat(t," ").concat(s||"").trim(),f=c.useRef("_".concat(Ae()));return Z(n,"".concat(t),{defIds:n.defIds,idSuffix:f.current},S({ref:e,className:h},a),r)});function Z(i,e,n,t,s){return c.createElement(i.tag,S(S({key:e},je(i,n,s)),t),(Le(i,n).children||[]).map(function(r,a){return Z(r,"".concat(e,"-").concat(i.tag,"-").concat(a),n,void 0,s)}))}function je(i,e,n){var t=S({},i.attrs);n!=null&&n.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=n.colorChannel1);var s=e.defIds;return!s||s.length===0||(i.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+e.idSuffix),Object.entries(t).forEach(function(r){var a=r[0],h=r[1];typeof h=="string"&&(t[a]=h.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),t}function Le(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)?S(S({},i),{children:i.children.map(function(s){return typeof s.attrs.id=="string"&&t&&t.indexOf(s.attrs.id)>-1?S(S({},s),{attrs:S(S({},s.attrs),{id:s.attrs.id+e.idSuffix})}):s})}):i}function Ae(){return Math.random().toString(36).substring(2,8)}Y.displayName="UniverIcon";var we={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_217_40",style:{maskType:"alpha"},width:17,height:17,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0.9 0.09H16.9V16.09H0.9z"}}]},{tag:"g",attrs:{mask:"url(#mask0_217_40)"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.39551 7.37266C2.39551 4.18105 4.98281 1.59375 8.17441 1.59375C11.366 1.59375 13.9533 4.18105 13.9533 7.37266C13.9533 8.72342 13.4898 9.96603 12.7133 10.95L15.1964 13.4331C15.4619 13.6986 15.4619 14.1291 15.1964 14.3946C14.9309 14.6601 14.5004 14.6601 14.2349 14.3946L11.7518 11.9115C10.7678 12.6881 9.52525 13.1516 8.17441 13.1516C4.98281 13.1516 2.39551 10.5642 2.39551 7.37266ZM8.17441 2.95349C5.73378 2.95349 3.75525 4.93202 3.75525 7.37266C3.75525 9.81333 5.73378 11.7918 8.17441 11.7918C10.6151 11.7918 12.5936 9.81333 12.5936 7.37266C12.5936 4.93202 10.6151 2.95349 8.17441 2.95349Z",fillRule:"evenodd",clipRule:"evenodd"}}]}]},J=c.forwardRef(function(i,e){return c.createElement(Y,Object.assign({},i,{id:"search-single-16",ref:e,icon:we}))});J.displayName="SearchSingle16";const Q="FIND_REPLACE_INPUT_FOCUS",X="FIND_REPLACE_DIALOG_FOCUS",ee="FIND_REPLACE_REPLACE_REVEALED";var Ue=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,te=(i,e,n,t)=>{for(var s=t>1?void 0:t?Be(e,n):e,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=(t?a(e,n,s):a(s))||s);return t&&s&&Ue(e,n,s),s},A=(i,e)=>(n,t)=>e(n,t,i);class ke extends o.Disposable{}const C=o.createIdentifier("find-replace.service");function We(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"}let w=class extends o.Disposable{constructor(e,n,t){super();l(this,"currentMatch$",new g.BehaviorSubject(null));l(this,"replaceables$",new g.BehaviorSubject([]));l(this,"_findModels",[]);l(this,"_matchingModel",null);l(this,"_matches",[]);l(this,"_currentSearchingDisposables",null);this._state=e,this._providers=n,this._univerInstanceService=t,this.disposeWithMe(this._state.stateUpdates$.pipe(g.throttleTime(200,void 0,{leading:!0,trailing:!0})).subscribe(async s=>{const r=this._state.state;We(s)&&(r.findString!==""&&!r.replaceRevealed?(await this._startSearching(),this._state.changeState({findCompleted:!0})):s.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({...B(),revealed:!1})}async start(){if(!this._state.findString)return{results:[]};const e=await this._startSearching();return this._state.changeState({findCompleted:!0}),e}async _startSearching(){if(!this._state.findString)return{results:[]};const e=Array.from(this._providers),n=this._findModels=(await Promise.all(e.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(n);const t=this._matches=n.map(s=>s.getMatches()).flat();return this.replaceables$.next(t.filter(s=>s.replaceable)),t.length?(this._moveToInitialMatch(n),this._state.changeState({matchesCount:t.length}),{results:t}):(this._state.changeState({matchesCount:0,matchesPosition:0}),{results:[]})}_stopSearching(){var e;this._providers.forEach(n=>n.terminate()),this._findModels=[],this._matches=[],this._matchingModel=null,(e=this._currentSearchingDisposables)==null||e.dispose(),this._currentSearchingDisposables=null,this.currentMatch$.next(null),this.replaceables$.next([]),this._state.changeState({findCompleted:!1,matchesCount:0,matchesPosition:0})}_subscribeToModelsChanges(e){const n=this._currentSearchingDisposables=new o.DisposableCollection,t=g.combineLatest(e.map(s=>s.matchesUpdate$)).pipe(g.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(a=>a.replaceable))):(this._state.changeState({matchesCount:0,matchesPosition:0}),this.replaceables$.next([]))});e.forEach(s=>n.add(o.toDisposable(s.activelyChangingMatch$.subscribe(r=>{const a=this._matches.findIndex(h=>h===r);this._state.changeState({matchesPosition:a+1})})))),n.add(o.toDisposable(t))}async replace(){return this._matchingModel?this._matchingModel.replace(this._state.replaceString):!1}async replaceAll(){const e=await Promise.all(this._findModels.map(n=>n.replaceAll(this._state.replaceString))).then(n=>n.reduce((t,s)=>(t.success+=s.success,t.failure+=s.failure,t),{success:0,failure:0}));return e.failure===0&&this._stopSearching(),e}getCurrentMatch(){return this._state.matchesPosition>0?this._matches[this._state.matchesPosition-1]:null}_markMatch(e){const n=this._matches.findIndex(t=>t===e);this.currentMatch$.next(e),this._state.changeState({matchesPosition:n+1})}moveToNextMatch(){if(!this._matchingModel)return;const e=this._findModels.length===1,n=this._matchingModel.moveToNextMatch({loop:e});if(n)this._markMatch(n);else{const t=this._findModels.findIndex(s=>s===this._matchingModel);this._moveToNextUnitMatch(t)}}_moveToNextUnitMatch(e){const n=this._findModels.length;for(let t=(e+1)%n;t!==e;){const s=this._findModels[t],r=s.moveToNextMatch({ignoreSelection:!0});if(r){this._matchingModel=s,this._markMatch(r);return}t=(t+1)%n}if(this._matchingModel){const t=this._matchingModel.moveToNextMatch({ignoreSelection:!0});t&&this._markMatch(t)}}moveToPreviousMatch(){if(!this._matchingModel)return;const e=this._findModels.length===1,n=this._matchingModel.moveToPreviousMatch({loop:e});if(n){const t=this._matches.findIndex(s=>s===n);this.currentMatch$.next(n),this._state.changeState({matchesPosition:t+1})}else{const t=this._findModels.length,s=this._findModels.findIndex(a=>a===this._matchingModel);for(let a=(s-1+t)%t;a!==s;){const h=this._findModels[a],f=h.moveToPreviousMatch({ignoreSelection:!0});if(f){this._matchingModel=h,this._markMatch(f);return}a=(a-1)%t}const r=this._matchingModel.moveToPreviousMatch({ignoreSelection:!0});r&&this._markMatch(r)}}_moveToInitialMatch(e,n=!1){var r;const t=(r=this._univerInstanceService.getFocusedUnit())==null?void 0:r.getUnitId();if(!t)return-1;const s=e.findIndex(a=>a.unitId===t);if(s!==-1){this._matchingModel=e[s];const a=this._matchingModel.moveToNextMatch({stayIfOnMatch:!0,noFocus:n});if(a)return this._markMatch(a),s}return this._moveToNextUnitMatch(s),0}};w=te([A(2,o.IUniverInstanceService)],w);var D=(i=>(i.ROW="row",i.COLUMN="column",i))(D||{}),O=(i=>(i.VALUE="value",i.FORMULA="formula",i))(O||{}),T=(i=>(i.SUBUNIT="subunit",i.UNIT="unit",i))(T||{});function B(){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 Ge{constructor(){l(this,"_stateUpdates$",new g.Subject);l(this,"stateUpdates$",this._stateUpdates$.asObservable());l(this,"_state$",new g.BehaviorSubject(B()));l(this,"state$",this._state$.asObservable());l(this,"_findString","");l(this,"_inputtingFindString","");l(this,"_replaceString","");l(this,"_revealed",!1);l(this,"_replaceRevealed",!1);l(this,"_matchesPosition",0);l(this,"_matchesCount",0);l(this,"_caseSensitive",!0);l(this,"_matchesTheWholeCell",!1);l(this,"_findDirection","row");l(this,"_findScope","subunit");l(this,"_findBy","value");l(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 U=class extends o.Disposable{constructor(e,n){super();l(this,"_providers",new Set);l(this,"_state",new Ge);l(this,"_model");l(this,"_currentMatch$",new g.BehaviorSubject(null));l(this,"currentMatch$",this._currentMatch$.asObservable());l(this,"_replaceables$",new g.BehaviorSubject([]));l(this,"replaceables$",this._replaceables$.asObservable());l(this,"_focusSignal$",new g.Subject);l(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()}getCurrentMatch(){var e;return(e=this._model)==null?void 0:e.getCurrentMatch()}getFindString(){return this._state.findString}changeFindString(e){this._state.changeState({findString:e})}focusFindInput(){this._focusSignal$.next()}changeInputtingFindString(e){e?this._state.changeState({inputtingFindString:e}):this._state.changeState({inputtingFindString:"",findString:""})}changeReplaceString(e){this._state.changeState({replaceString:e})}changeMatchesTheWholeCell(e){this._state.changeState({matchesTheWholeCell:e})}changeCaseSensitive(e){this._state.changeState({caseSensitive:e})}changeFindBy(e){this._state.changeState({findBy:e}),this._toggleDisplayRawFormula(e==="formula")}changeFindScope(e){this._state.changeState({findScope:e})}changeFindDirection(e){this._state.changeState({findDirection:e})}moveToNextMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToNextMatch(),this._focusSignal$.next())}moveToPreviousMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToPreviousMatch(),this._focusSignal$.next())}async replace(){return this._model?this._model.replace():!1}async replaceAll(){if(!this._model)throw new Error("[FindReplaceService] replaceAll: model is not initialized!");return this._model.replaceAll()}revealReplace(){this._state.changeState({replaceRevealed:!0,inputtingFindString:this._state.findString}),this._toggleRevealReplace(!0)}start(e=!1){if(this._providers.size===0)return!1;this._model=this._injector.createInstance(w,this._state,this._providers),this._model.currentMatch$.subscribe(t=>this._currentMatch$.next(t)),this._model.replaceables$.subscribe(t=>this._replaceables$.next(t));const n=B();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(ee,e)}_toggleDisplayRawFormula(e){this._contextService.setContextValue(Pe.RENDER_RAW_FORMULA_KEY,e)}};U=te([A(0,o.Inject(o.Injector)),A(1,o.IContextService)],U);const k={id:"ui.command.replace-current-match",type:o.CommandType.COMMAND,handler:i=>i.get(C).replace()},Ve="CONFIRM_REPLACE_ALL",W={id:"ui.command.replace-all-matches",type:o.CommandType.COMMAND,handler:async i=>{const e=i.get(u.IConfirmService),n=i.get(o.LocaleService),t=i.get(u.IMessageService);if(!await e.confirm({id:Ve,title:{title:n.t("find-replace.replace.confirm.title")},cancelText:n.t("button.cancel"),confirmText:n.t("button.confirm")}))return!1;const r=await i.get(C).replaceAll(),{success:a,failure:h}=r;return h>0?(a===0?t.show({type:p.MessageType.Error,content:n.t("find-replace.replace.all-failure")}):t.show({type:p.MessageType.Warning,content:n.t("find-replace.replace.partial-success",`${a}`,`${h}`)}),!1):(t.show({type:p.MessageType.Success,content:n.t("find-replace.replace.all-success",`${a}`)}),!0)}},y={id:"ui.operation.open-find-dialog",type:o.CommandType.OPERATION,handler:i=>{const e=i.get(C);return e.revealed?e.focusFindInput():e.start(),!0}},E={id:"ui.operation.open-replace-dialog",type:o.CommandType.OPERATION,handler:i=>{const e=i.get(C);return e.revealed?e.replaceRevealed?e.focusFindInput():e.revealReplace():e.start(!0),!0}},G={type:o.CommandType.OPERATION,id:"ui.operation.go-to-next-match",handler:i=>(i.get(C).moveToNextMatch(),!0)},V={type:o.CommandType.OPERATION,id:"ui.operation.go-to-previous-match",handler:i=>(i.get(C).moveToPreviousMatch(),!0)};var ie={exports:{}},N={};/**
|
|
1
|
+
"use strict";var Te=Object.defineProperty;var Pe=(i,e,n)=>e in i?Te(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n;var l=(i,e,n)=>Pe(i,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),p=require("@univerjs/ui"),v=require("rxjs"),f=require("@univerjs/design"),Ee=require("@univerjs/engine-render"),c=require("react"),Ne="find-replace.config",Le={};var C=function(){return C=Object.assign||function(i){for(var e,n=1,t=arguments.length;n<t;n++){e=arguments[n];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=e[s])}return i},C.apply(this,arguments)},$e=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 s=0,t=Object.getOwnPropertySymbols(i);s<t.length;s++)e.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(i,t[s])&&(n[t[s]]=i[t[s]]);return n},Q=c.forwardRef(function(i,e){var n=i.icon,t=i.id,s=i.className,r=i.extend,a=$e(i,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(t," ").concat(s||"").trim(),u=c.useRef("_".concat(we()));return X(n,"".concat(t),{defIds:n.defIds,idSuffix:u.current},C({ref:e,className:d},a),r)});function X(i,e,n,t,s){return c.createElement(i.tag,C(C({key:e},je(i,n,s)),t),(Ae(i,n).children||[]).map(function(r,a){return X(r,"".concat(e,"-").concat(i.tag,"-").concat(a),n,void 0,s)}))}function je(i,e,n){var t=C({},i.attrs);n!=null&&n.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=n.colorChannel1);var s=e.defIds;return!s||s.length===0||(i.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+e.idSuffix),Object.entries(t).forEach(function(r){var a=r[0],d=r[1];typeof d=="string"&&(t[a]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),t}function Ae(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)?C(C({},i),{children:i.children.map(function(s){return typeof s.attrs.id=="string"&&t&&t.indexOf(s.attrs.id)>-1?C(C({},s),{attrs:C(C({},s.attrs),{id:s.attrs.id+e.idSuffix})}):s})}):i}function we(){return Math.random().toString(36).substring(2,8)}Q.displayName="UniverIcon";var Ue={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_217_40",style:{maskType:"alpha"},width:17,height:17,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0.9 0.09H16.9V16.09H0.9z"}}]},{tag:"g",attrs:{mask:"url(#mask0_217_40)"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.39551 7.37266C2.39551 4.18105 4.98281 1.59375 8.17441 1.59375C11.366 1.59375 13.9533 4.18105 13.9533 7.37266C13.9533 8.72342 13.4898 9.96603 12.7133 10.95L15.1964 13.4331C15.4619 13.6986 15.4619 14.1291 15.1964 14.3946C14.9309 14.6601 14.5004 14.6601 14.2349 14.3946L11.7518 11.9115C10.7678 12.6881 9.52525 13.1516 8.17441 13.1516C4.98281 13.1516 2.39551 10.5642 2.39551 7.37266ZM8.17441 2.95349C5.73378 2.95349 3.75525 4.93202 3.75525 7.37266C3.75525 9.81333 5.73378 11.7918 8.17441 11.7918C10.6151 11.7918 12.5936 9.81333 12.5936 7.37266C12.5936 4.93202 10.6151 2.95349 8.17441 2.95349Z",fillRule:"evenodd",clipRule:"evenodd"}}]}]},ee=c.forwardRef(function(i,e){return c.createElement(Q,Object.assign({},i,{id:"search-single-16",ref:e,icon:Ue}))});ee.displayName="SearchSingle16";const te="FIND_REPLACE_INPUT_FOCUS",ie="FIND_REPLACE_DIALOG_FOCUS",ne="FIND_REPLACE_REPLACE_REVEALED";var Be=Object.defineProperty,ke=Object.getOwnPropertyDescriptor,se=(i,e,n,t)=>{for(var s=t>1?void 0:t?ke(e,n):e,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=(t?a(e,n,s):a(s))||s);return t&&s&&Be(e,n,s),s},w=(i,e)=>(n,t)=>e(n,t,i);class We extends o.Disposable{}const R=o.createIdentifier("find-replace.service");function Ge(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"}let U=class extends o.Disposable{constructor(e,n,t){super();l(this,"currentMatch$",new v.BehaviorSubject(null));l(this,"replaceables$",new v.BehaviorSubject([]));l(this,"_findModels",[]);l(this,"_matchingModel",null);l(this,"_matches",[]);l(this,"_currentSearchingDisposables",null);this._state=e,this._providers=n,this._univerInstanceService=t,this.disposeWithMe(this._state.stateUpdates$.pipe(v.throttleTime(200,void 0,{leading:!0,trailing:!0})).subscribe(async s=>{const r=this._state.state;Ge(s)&&(r.findString!==""&&!r.replaceRevealed?(await this._startSearching(),this._state.changeState({findCompleted:!0})):s.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({...k(),revealed:!1})}async start(){if(!this._state.findString)return{results:[]};const e=await this._startSearching();return this._state.changeState({findCompleted:!0}),e}async _startSearching(){if(!this._state.findString)return{results:[]};const e=Array.from(this._providers),n=this._findModels=(await Promise.all(e.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(n);const t=this._matches=n.map(s=>s.getMatches()).flat();return this.replaceables$.next(t.filter(s=>s.replaceable)),t.length?(this._moveToInitialMatch(n),this._state.changeState({matchesCount:t.length}),{results:t}):(this._state.changeState({matchesCount:0,matchesPosition:0}),{results:[]})}_stopSearching(){var e;this._providers.forEach(n=>n.terminate()),this._findModels=[],this._matches=[],this._matchingModel=null,(e=this._currentSearchingDisposables)==null||e.dispose(),this._currentSearchingDisposables=null,this.currentMatch$.next(null),this.replaceables$.next([]),this._state.changeState({findCompleted:!1,matchesCount:0,matchesPosition:0})}_subscribeToModelsChanges(e){const n=this._currentSearchingDisposables=new o.DisposableCollection,t=v.combineLatest(e.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(a=>a.replaceable))):(this._state.changeState({matchesCount:0,matchesPosition:0}),this.replaceables$.next([]))});e.forEach(s=>n.add(o.toDisposable(s.activelyChangingMatch$.subscribe(r=>{const a=this._matches.findIndex(d=>d===r);this._state.changeState({matchesPosition:a+1})})))),n.add(o.toDisposable(t))}async replace(){return this._matchingModel?this._matchingModel.replace(this._state.replaceString):!1}async replaceAll(){const e=await Promise.all(this._findModels.map(n=>n.replaceAll(this._state.replaceString))).then(n=>n.reduce((t,s)=>(t.success+=s.success,t.failure+=s.failure,t),{success:0,failure:0}));return e.failure===0&&this._stopSearching(),e}getCurrentMatch(){return this._state.matchesPosition>0?this._matches[this._state.matchesPosition-1]:null}_markMatch(e){const n=this._matches.findIndex(t=>t===e);this.currentMatch$.next(e),this._state.changeState({matchesPosition:n+1})}moveToNextMatch(){if(!this._matchingModel)return;const e=this._findModels.length===1,n=this._matchingModel.moveToNextMatch({loop:e});if(n)this._markMatch(n);else{const t=this._findModels.findIndex(s=>s===this._matchingModel);this._moveToNextUnitMatch(t)}}_moveToNextUnitMatch(e){const n=this._findModels.length;for(let t=(e+1)%n;t!==e;){const s=this._findModels[t],r=s.moveToNextMatch({ignoreSelection:!0});if(r){this._matchingModel=s,this._markMatch(r);return}t=(t+1)%n}if(this._matchingModel){const t=this._matchingModel.moveToNextMatch({ignoreSelection:!0});t&&this._markMatch(t)}}moveToPreviousMatch(){if(!this._matchingModel)return;const e=this._findModels.length===1,n=this._matchingModel.moveToPreviousMatch({loop:e});if(n){const t=this._matches.findIndex(s=>s===n);this.currentMatch$.next(n),this._state.changeState({matchesPosition:t+1})}else{const t=this._findModels.length,s=this._findModels.findIndex(a=>a===this._matchingModel);for(let a=(s-1+t)%t;a!==s;){const d=this._findModels[a],u=d.moveToPreviousMatch({ignoreSelection:!0});if(u){this._matchingModel=d,this._markMatch(u);return}a=(a-1)%t}const r=this._matchingModel.moveToPreviousMatch({ignoreSelection:!0});r&&this._markMatch(r)}}_moveToInitialMatch(e,n=!1){var r;const t=(r=this._univerInstanceService.getFocusedUnit())==null?void 0:r.getUnitId();if(!t)return-1;const s=e.findIndex(a=>a.unitId===t);if(s!==-1){this._matchingModel=e[s];const a=this._matchingModel.moveToNextMatch({stayIfOnMatch:!0,noFocus:n});if(a)return this._markMatch(a),s}return this._moveToNextUnitMatch(s),0}};U=se([w(2,o.IUniverInstanceService)],U);var O=(i=>(i.ROW="row",i.COLUMN="column",i))(O||{}),T=(i=>(i.VALUE="value",i.FORMULA="formula",i))(T||{}),P=(i=>(i.SUBUNIT="subunit",i.UNIT="unit",i))(P||{});function k(){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 Ve{constructor(){l(this,"_stateUpdates$",new v.Subject);l(this,"stateUpdates$",this._stateUpdates$.asObservable());l(this,"_state$",new v.BehaviorSubject(k()));l(this,"state$",this._state$.asObservable());l(this,"_findString","");l(this,"_inputtingFindString","");l(this,"_replaceString","");l(this,"_revealed",!1);l(this,"_replaceRevealed",!1);l(this,"_matchesPosition",0);l(this,"_matchesCount",0);l(this,"_caseSensitive",!0);l(this,"_matchesTheWholeCell",!1);l(this,"_findDirection","row");l(this,"_findScope","subunit");l(this,"_findBy","value");l(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 B=class extends o.Disposable{constructor(e,n){super();l(this,"_providers",new Set);l(this,"_state",new Ve);l(this,"_model");l(this,"_currentMatch$",new v.BehaviorSubject(null));l(this,"currentMatch$",this._currentMatch$.asObservable());l(this,"_replaceables$",new v.BehaviorSubject([]));l(this,"replaceables$",this._replaceables$.asObservable());l(this,"_focusSignal$",new v.Subject);l(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()}getCurrentMatch(){var e;return(e=this._model)==null?void 0:e.getCurrentMatch()}getFindString(){return this._state.findString}changeFindString(e){this._state.changeState({findString:e})}focusFindInput(){this._focusSignal$.next()}changeInputtingFindString(e){e?this._state.changeState({inputtingFindString:e}):this._state.changeState({inputtingFindString:"",findString:""})}changeReplaceString(e){this._state.changeState({replaceString:e})}changeMatchesTheWholeCell(e){this._state.changeState({matchesTheWholeCell:e})}changeCaseSensitive(e){this._state.changeState({caseSensitive:e})}changeFindBy(e){this._state.changeState({findBy:e}),this._toggleDisplayRawFormula(e==="formula")}changeFindScope(e){this._state.changeState({findScope:e})}changeFindDirection(e){this._state.changeState({findDirection:e})}moveToNextMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToNextMatch(),this._focusSignal$.next())}moveToPreviousMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToPreviousMatch(),this._focusSignal$.next())}async replace(){return this._model?this._model.replace():!1}async replaceAll(){if(!this._model)throw new Error("[FindReplaceService] replaceAll: model is not initialized!");return this._model.replaceAll()}revealReplace(){this._state.changeState({replaceRevealed:!0,inputtingFindString:this._state.findString}),this._toggleRevealReplace(!0)}start(e=!1){if(this._providers.size===0)return!1;this._model=this._injector.createInstance(U,this._state,this._providers),this._model.currentMatch$.subscribe(t=>this._currentMatch$.next(t)),this._model.replaceables$.subscribe(t=>this._replaceables$.next(t));const n=k();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(ne,e)}_toggleDisplayRawFormula(e){this._contextService.setContextValue(Ee.RENDER_RAW_FORMULA_KEY,e)}};B=se([w(0,o.Inject(o.Injector)),w(1,o.IContextService)],B);const W={id:"ui.command.replace-current-match",type:o.CommandType.COMMAND,handler:i=>i.get(R).replace()},He="CONFIRM_REPLACE_ALL",G={id:"ui.command.replace-all-matches",type:o.CommandType.COMMAND,handler:async i=>{const e=i.get(p.IConfirmService),n=i.get(o.LocaleService),t=i.get(p.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 r=await i.get(R).replaceAll(),{success:a,failure:d}=r;return d>0?(a===0?t.show({type:f.MessageType.Error,content:n.t("find-replace.replace.all-failure")}):t.show({type:f.MessageType.Warning,content:n.t("find-replace.replace.partial-success",`${a}`,`${d}`)}),!1):(t.show({type:f.MessageType.Success,content:n.t("find-replace.replace.all-success",`${a}`)}),!0)}},x={id:"ui.operation.open-find-dialog",type:o.CommandType.OPERATION,handler:i=>{const e=i.get(R);return e.revealed?e.focusFindInput():e.start(),!0}},N={id:"ui.operation.open-replace-dialog",type:o.CommandType.OPERATION,handler:i=>{const e=i.get(R);return e.revealed?e.replaceRevealed?e.focusFindInput():e.revealReplace():e.start(!0),!0}},V={type:o.CommandType.OPERATION,id:"ui.operation.go-to-next-match",handler:i=>(i.get(R).moveToNextMatch(),!0)},H={type:o.CommandType.OPERATION,id:"ui.operation.go-to-previous-match",handler:i=>(i.get(R).moveToPreviousMatch(),!0)};var j={exports:{}},I={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var He=c,Ke=Symbol.for("react.element"),qe=Symbol.for("react.fragment"),ze=Object.prototype.hasOwnProperty,Ye=He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ze={key:!0,ref:!0,__self:!0,__source:!0};function ne(i,e,n){var t,s={},r=null,a=null;n!==void 0&&(r=""+n),e.key!==void 0&&(r=""+e.key),e.ref!==void 0&&(a=e.ref);for(t in e)ze.call(e,t)&&!Ze.hasOwnProperty(t)&&(s[t]=e[t]);if(i&&i.defaultProps)for(t in e=i.defaultProps,e)s[t]===void 0&&(s[t]=e[t]);return{$$typeof:Ke,type:i,key:r,ref:a,props:s,_owner:Ye.current}}N.Fragment=qe;N.jsx=ne;N.jsxs=ne;ie.exports=N;var d=ie.exports;function se(i){const{findCompleted:e,localeService:n,matchesCount:t,matchesPosition:s,findString:r,findReplaceService:a,onChange:h,...f}=i,v=e&&t===0?n.t("find-replace.dialog.no-result"):t===0?" ":void 0;return d.jsx(p.InputWithSlot,{autoFocus:!0,placeholder:n.t("find-replace.dialog.find-placeholder"),slot:d.jsx(p.Pager,{loop:!0,text:v,value:s,total:t,onChange:m=>{s===t&&m===1?a.moveToNextMatch():s===1&&m===t||m<s?a.moveToPreviousMatch():a.moveToNextMatch()}}),value:r,onChange:m=>h==null?void 0:h(m),...f})}const Je="univer-find-replace-dialog-container",Qe="univer-find-replace-expand-container",Xe="univer-button-text",et="univer-find-replace-buttons-group",tt="univer-find-replace-buttons-group-right",P={findReplaceDialogContainer:Je,findReplaceExpandContainer:Qe,buttonText:Xe,findReplaceButtonsGroup:et,findReplaceButtonsGroupRight:tt};function re(i,e){const n=c.useCallback(()=>{var s;(s=document.querySelector(".univer-find-input input"))==null||s.focus()},[]),t=c.useCallback(()=>{const s=document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");return Array.from(s).some(r=>r===document.activeElement)},[]);return c.useImperativeHandle(e,()=>({focus:n,selectHasFocus:t})),c.useEffect(()=>{const s=i.focusSignal$.subscribe(()=>n());return()=>s.unsubscribe()},[i,n]),{focus:n,selectHasFocus:t}}const it=c.forwardRef(function(e,n){const t=o.useDependency(o.LocaleService),s=o.useDependency(C),r=o.useDependency(o.ICommandService),a=u.useObservable(s.state$,void 0,!0),{findCompleted:h,findString:f,matchesCount:b,matchesPosition:v}=a,m=c.useCallback(()=>{r.executeCommand(E.id)},[r]),x=c.useCallback(M=>s.changeFindString(M),[s]);return re(s,n),d.jsxs(c.Fragment,{children:[d.jsx(se,{findCompleted:h,className:"univer-find-input",matchesCount:b,matchesPosition:v,findReplaceService:s,localeService:t,findString:f,onChange:x}),d.jsx("div",{className:P.findReplaceExpandContainer,children:d.jsx(p.Button,{type:"text",size:"small",onClick:m,children:t.t("find-replace.dialog.advanced-finding")})})]})}),nt=c.forwardRef(function(e,n){const t=o.useDependency(C),s=o.useDependency(o.LocaleService),r=o.useDependency(o.ICommandService),a=o.useDependency(u.IMessageService),h=u.useObservable(t.currentMatch$,void 0,!0),f=u.useObservable(t.replaceables$,void 0,!0),b=u.useObservable(t.state$,void 0,!0),{matchesCount:v,matchesPosition:m,findString:x,inputtingFindString:M,replaceString:ce,caseSensitive:le,matchesTheWholeCell:de,findDirection:ue,findScope:he,findBy:pe,findCompleted:j}=b,fe=M.length===0,_e=v===0||!(h!=null&&h.replaceable),ge=f.length===0,me=c.useCallback(_=>t.changeInputtingFindString(_),[t]),ve=c.useCallback(_=>t.changeReplaceString(_),[t]),{focus:Se}=re(t,n),Ce=c.useCallback(()=>{x===M?t.moveToNextMatch():(t.changeFindString(M),t.find())},[x,M,t]),Re=c.useCallback(()=>r.executeCommand(k.id),[r]),be=c.useCallback(async()=>{await r.executeCommand(W.id),Se()},[r]),Me=c.useCallback(_=>{t.changeFindDirection(_)},[t]),ye=c.useCallback(_=>{t.changeFindScope(_)},[t]),Ie=c.useCallback(_=>{t.changeFindBy(_)},[t]),xe=rt(s),Fe=at(s),De=ot(s);return c.useEffect(()=>{const _=j&&v===0;let F=null;return _&&(F=a.show({content:s.t("find-replace.dialog.no-match"),type:p.MessageType.Warning,duration:5e3})),()=>F==null?void 0:F.dispose()},[j,v,a,s]),d.jsxs(c.Fragment,{children:[d.jsx(p.FormLayout,{label:s.t("find-replace.dialog.find"),children:d.jsx(se,{findCompleted:j,className:"univer-find-input",matchesCount:v,matchesPosition:m,findReplaceService:t,localeService:s,findString:M,onChange:me})}),d.jsx(p.FormLayout,{label:s.t("find-replace.dialog.replace"),children:d.jsx(p.Input,{placeholder:s.t("find-replace.dialog.replace-placeholder"),value:ce,onChange:_=>ve(_)})}),d.jsx(p.FormLayout,{label:s.t("find-replace.dialog.find-direction.title"),children:d.jsx(p.Select,{value:ue,options:Fe,onChange:Me})}),d.jsx(p.FormDualColumnLayout,{children:d.jsxs(c.Fragment,{children:[d.jsx(p.FormLayout,{label:s.t("find-replace.dialog.find-scope.title"),children:d.jsx(p.Select,{value:he,options:xe,onChange:ye})}),d.jsx(p.FormLayout,{label:s.t("find-replace.dialog.find-by.title"),children:d.jsx(p.Select,{value:pe,options:De,onChange:Ie})})]})}),d.jsx(p.FormDualColumnLayout,{children:d.jsxs(c.Fragment,{children:[d.jsx(p.FormLayout,{children:d.jsx(p.Checkbox,{checked:le,onChange:_=>{t.changeCaseSensitive(_)},children:s.t("find-replace.dialog.case-sensitive")})}),d.jsx(p.FormLayout,{children:d.jsx(p.Checkbox,{checked:de,onChange:_=>{t.changeMatchesTheWholeCell(_)},children:s.t("find-replace.dialog.match-the-whole-cell")})})]})}),d.jsxs("div",{className:P.findReplaceButtonsGroup,children:[d.jsx(p.Button,{type:"primary",onClick:Ce,disabled:fe,children:s.t("find-replace.dialog.find")}),d.jsxs("span",{className:P.findReplaceButtonsGroupRight,children:[d.jsx(p.Button,{disabled:_e,onClick:Re,children:s.t("find-replace.dialog.replace")}),d.jsx(p.Button,{disabled:ge,onClick:be,children:s.t("find-replace.dialog.replace-all")})]})]})]})});function st(){const i=o.useDependency(C),e=o.useDependency(u.ILayoutService),n=o.useDependency(o.IContextService),t=u.useObservable(i.state$,void 0,!0),s=c.useRef(null);c.useEffect(()=>{let f;return s.current&&(f=e.registerContainerElement(s.current)),()=>f==null?void 0:f.dispose()},[e]);const r=c.useRef(null),a=c.useCallback(f=>n.setContextValue(X,f),[n]),h=c.useCallback(f=>n.setContextValue(Q,f),[n]);return c.useEffect(()=>{var b;const f=g.fromEvent(document,"focusin").subscribe(v=>{var m;v.target&&((m=s.current)!=null&&m.contains(v.target))?a(!0):a(!1),!r.current||!r.current.selectHasFocus()?h(!0):h(!1)});return(b=r.current)==null||b.focus(),a(!0),h(!0),()=>{f.unsubscribe(),a(!1)}},[a,h]),d.jsx("div",{className:P.findReplaceDialogContainer,ref:s,children:t.replaceRevealed?d.jsx(nt,{ref:r}):d.jsx(it,{ref:r})})}function rt(i){const e=i.getCurrentLocale();return c.useMemo(()=>[{label:i.t("find-replace.dialog.find-scope.current-sheet"),value:T.SUBUNIT},{label:i.t("find-replace.dialog.find-scope.workbook"),value:T.UNIT}],[e])}function at(i){const e=i.getCurrentLocale();return c.useMemo(()=>[{label:i.t("find-replace.dialog.find-direction.row"),value:D.ROW},{label:i.t("find-replace.dialog.find-direction.column"),value:D.COLUMN}],[e])}function ot(i){const e=i.getCurrentLocale();return c.useMemo(()=>[{label:i.t("find-replace.dialog.find-by.value"),value:O.VALUE},{label:i.t("find-replace.dialog.find-by.formula"),value:O.FORMULA}],[e])}function I(i){return i.getContextValue(X)}function ct(i){return i.getContextValue(ee)}function ae(i){return i.getContextValue(Q)}const $="7_find-replace-shortcuts";function H(i){return i.getContextValue(o.FOCUSING_SHEET)}function K(i){return!i.getContextValue(o.EDITOR_ACTIVATED)}const lt={id:y.id,description:"find-replace.shortcut.open-find-dialog",binding:u.KeyCode.F|u.MetaKeys.CTRL_COMMAND,group:$,preconditions(i){return!I(i)&&H(i)&&K(i)}},dt={id:y.id,description:"find-replace.shortcut.open-find-dialog",binding:u.KeyCode.F|u.MetaKeys.CTRL_COMMAND,mac:u.KeyCode.F|u.MetaKeys.MAC_CTRL,preconditions(i){return!I(i)&&H(i)&&K(i)}},ut={id:E.id,description:"find-replace.shortcut.open-replace-dialog",binding:u.KeyCode.H|u.MetaKeys.CTRL_COMMAND,mac:u.KeyCode.H|u.MetaKeys.MAC_CTRL,group:$,preconditions(i){return H(i)&&K(i)&&(!I(i)||!ct(i))}},ht={id:G.id,description:"find-replace.shortcut.go-to-next-match",binding:u.KeyCode.ENTER,group:$,priority:1e3,preconditions(i){return ae(i)&&I(i)}},pt={id:V.id,description:"find-replace.shortcut.go-to-previous-match",binding:u.KeyCode.ENTER|u.MetaKeys.SHIFT,group:$,priority:1e3,preconditions(i){return ae(i)&&I(i)}};function ft(i){const e=i.get(o.IContextService);return{id:y.id,icon:"SearchIcon",tooltip:"find-replace.toolbar",type:u.MenuItemType.BUTTON,hidden$:u.getMenuHiddenObservable(i,o.UniverInstanceType.UNIVER_SHEET),disabled$:g.combineLatest([e.subscribeContextValue$(o.EDITOR_ACTIVATED),e.subscribeContextValue$(o.FOCUSING_SHEET)]).pipe(g.map(([n,t])=>n||!t))}}const _t={[u.RibbonStartGroup.OTHERS]:{[y.id]:{order:2,menuItemFactory:ft}}};var gt=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,vt=(i,e,n,t)=>{for(var s=t>1?void 0:t?mt(e,n):e,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=(t?a(e,n,s):a(s))||s);return t&&s&>(e,n,s),s},R=(i,e)=>(n,t)=>e(n,t,i);const q="DESKTOP_FIND_REPLACE_DIALOG",oe=350,St=20,Ct=-90;exports.FindReplaceController=class extends o.RxDisposable{constructor(n,t,s,r,a,h,f,b,v,m){super();l(this,"_closingListenerDisposable");this._univerInstanceService=n,this._menuManagerService=t,this._shortcutService=s,this._commandService=r,this._findReplaceService=a,this._dialogService=h,this._layoutService=f,this._localeService=b,this._componentManager=v,this._injector=m,this._initCommands(),this._initUI(),this._initShortcuts()}dispose(){var n;super.dispose(),(n=this._closingListenerDisposable)==null||n.dispose(),this._closingListenerDisposable=null}_initCommands(){[y,E,G,V,W,k].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initShortcuts(){[ut,lt,dt,pt,ht].forEach(n=>this.disposeWithMe(this._shortcutService.registerShortcut(n)))}_initUI(){this.disposeWithMe(this._componentManager.register("FindReplaceDialog",st)),this.disposeWithMe(this._componentManager.register("SearchIcon",J)),this._menuManagerService.mergeMenu(_t),this._findReplaceService.stateUpdates$.pipe(g.takeUntil(this.dispose$)).subscribe(n=>{n.revealed===!0&&this._openPanel()})}_openPanel(){this._dialogService.open({id:q,draggable:!0,width:oe,title:{title:this._localeService.t("find-replace.dialog.title")},children:{label:"FindReplaceDialog"},destroyOnClose:!0,defaultPosition:Rt(),preservePositionOnDestroy:!0,onClose:()=>this.closePanel()}),this._closingListenerDisposable=o.toDisposable(this._univerInstanceService.focused$.pipe(g.takeUntil(this.dispose$)).subscribe(n=>{(!n||!this._univerInstanceService.getUniverSheetInstance(n))&&this.closePanel()}))}closePanel(){this._closingListenerDisposable&&(this._closingListenerDisposable.dispose(),this._closingListenerDisposable=null,this._dialogService.close(q),this._findReplaceService.terminate(),queueMicrotask(()=>this._layoutService.focus()))}};exports.FindReplaceController=vt([R(0,o.IUniverInstanceService),R(1,u.IMenuManagerService),R(2,u.IShortcutService),R(3,o.ICommandService),R(4,C),R(5,u.IDialogService),R(6,u.ILayoutService),R(7,o.Inject(o.LocaleService)),R(8,o.Inject(u.ComponentManager)),R(9,o.Inject(o.Injector))],exports.FindReplaceController);function Rt(){const{innerWidth:i}=window;return{x:(i-oe)/2-St,y:Ct}}var bt=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,yt=(i,e,n,t)=>{for(var s=t>1?void 0:t?Mt(e,n):e,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=(t?a(e,n,s):a(s))||s);return t&&s&&bt(e,n,s),s},z=(i,e)=>(n,t)=>e(n,t,i);const It="UNIVER_FIND_REPLACE_PLUGIN";var L;exports.UniverFindReplacePlugin=(L=class extends o.Plugin{constructor(e=Ne,n,t){super(),this._config=e,this._injector=n,this._configService=t;const{...s}=this._config;this._configService.setConfig(Ee,s)}onStarting(){[[exports.FindReplaceController],[C,{useClass:U}]].forEach(e=>this._injector.add(e))}onRendered(){this._injector.get(exports.FindReplaceController)}},l(L,"pluginName",It),L);exports.UniverFindReplacePlugin=yt([z(1,o.Inject(o.Injector)),z(2,o.IConfigService)],exports.UniverFindReplacePlugin);exports.FindBy=O;exports.FindDirection=D;exports.FindModel=ke;exports.FindScope=T;exports.GoToNextMatchOperation=G;exports.GoToPreviousMatchOperation=V;exports.IFindReplaceService=C;exports.OpenFindDialogOperation=y;exports.OpenReplaceDialogOperation=E;exports.ReplaceAllMatchesCommand=W;exports.ReplaceCurrentMatchCommand=k;
|
|
9
|
+
*/var J;function Ke(){if(J)return I;J=1;var i=c,e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),t=Object.prototype.hasOwnProperty,s=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,r={key:!0,ref:!0,__self:!0,__source:!0};function a(d,u,S){var _,g={},y=null,b=null;S!==void 0&&(y=""+S),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(b=u.ref);for(_ in u)t.call(u,_)&&!r.hasOwnProperty(_)&&(g[_]=u[_]);if(d&&d.defaultProps)for(_ in u=d.defaultProps,u)g[_]===void 0&&(g[_]=u[_]);return{$$typeof:e,type:d,key:y,ref:b,props:g,_owner:s.current}}return I.Fragment=n,I.jsx=a,I.jsxs=a,I}var z;function qe(){return z||(z=1,j.exports=Ke()),j.exports}var h=qe();function re(i){const{findCompleted:e,localeService:n,matchesCount:t,matchesPosition:s,findString:r,findReplaceService:a,onChange:d,...u}=i,_=e&&t===0?n.t("find-replace.dialog.no-result"):t===0?" ":void 0;return h.jsx(f.InputWithSlot,{autoFocus:!0,placeholder:n.t("find-replace.dialog.find-placeholder"),slot:h.jsx(f.Pager,{loop:!0,text:_,value:s,total:t,onChange:g=>{s===t&&g===1?a.moveToNextMatch():s===1&&g===t||g<s?a.moveToPreviousMatch():a.moveToNextMatch()}}),value:r,onChange:g=>d==null?void 0:d(g),...u})}const Je="univer-find-replace-dialog-container",ze="univer-find-replace-expand-container",Ye="univer-button-text",Ze="univer-find-replace-buttons-group",Qe="univer-find-replace-buttons-group-right",E={findReplaceDialogContainer:Je,findReplaceExpandContainer:ze,buttonText:Ye,findReplaceButtonsGroup:Ze,findReplaceButtonsGroupRight:Qe};function ae(i,e){const n=c.useCallback(()=>{var s;(s=document.querySelector(".univer-find-input input"))==null||s.focus()},[]),t=c.useCallback(()=>{const s=document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");return Array.from(s).some(r=>r===document.activeElement)},[]);return c.useImperativeHandle(e,()=>({focus:n,selectHasFocus:t})),c.useEffect(()=>{const s=i.focusSignal$.subscribe(()=>n());return()=>s.unsubscribe()},[i,n]),{focus:n,selectHasFocus:t}}const Xe=c.forwardRef(function(e,n){const t=o.useDependency(o.LocaleService),s=o.useDependency(R),r=o.useDependency(o.ICommandService),a=p.useObservable(s.state$,void 0,!0),{findCompleted:d,findString:u,matchesCount:S,matchesPosition:_}=a,g=c.useCallback(()=>{r.executeCommand(N.id)},[r]),y=c.useCallback(b=>s.changeFindString(b),[s]);return ae(s,n),h.jsxs(c.Fragment,{children:[h.jsx(re,{findCompleted:d,className:"univer-find-input",matchesCount:S,matchesPosition:_,findReplaceService:s,localeService:t,findString:u,onChange:y}),h.jsx("div",{className:E.findReplaceExpandContainer,children:h.jsx(f.Button,{type:"text",size:"small",onClick:g,children:t.t("find-replace.dialog.advanced-finding")})})]})}),et=c.forwardRef(function(e,n){const t=o.useDependency(R),s=o.useDependency(o.LocaleService),r=o.useDependency(o.ICommandService),a=o.useDependency(p.IMessageService),d=p.useObservable(t.currentMatch$,void 0,!0),u=p.useObservable(t.replaceables$,void 0,!0),S=p.useObservable(t.state$,void 0,!0),{matchesCount:_,matchesPosition:g,findString:y,inputtingFindString:b,replaceString:le,caseSensitive:de,matchesTheWholeCell:ue,findDirection:he,findScope:pe,findBy:fe,findCompleted:$}=S,_e=b.length===0,ge=_===0||!(d!=null&&d.replaceable),me=u.length===0,ve=c.useCallback(m=>t.changeInputtingFindString(m),[t]),Se=c.useCallback(m=>t.changeReplaceString(m),[t]),{focus:Ce}=ae(t,n),Re=c.useCallback(()=>{y===b?t.moveToNextMatch():(t.changeFindString(b),t.find())},[y,b,t]),be=c.useCallback(()=>r.executeCommand(W.id),[r]),Me=c.useCallback(async()=>{await r.executeCommand(G.id),Ce()},[r]),ye=c.useCallback(m=>{t.changeFindDirection(m)},[t]),xe=c.useCallback(m=>{t.changeFindScope(m)},[t]),Ie=c.useCallback(m=>{t.changeFindBy(m)},[t]),Fe=it(s),De=nt(s),Oe=st(s);return c.useEffect(()=>{const m=$&&_===0;let D=null;return m&&(D=a.show({content:s.t("find-replace.dialog.no-match"),type:f.MessageType.Warning,duration:5e3})),()=>D==null?void 0:D.dispose()},[$,_,a,s]),h.jsxs(c.Fragment,{children:[h.jsx(f.FormLayout,{label:s.t("find-replace.dialog.find"),children:h.jsx(re,{findCompleted:$,className:"univer-find-input",matchesCount:_,matchesPosition:g,findReplaceService:t,localeService:s,findString:b,onChange:ve})}),h.jsx(f.FormLayout,{label:s.t("find-replace.dialog.replace"),children:h.jsx(f.Input,{placeholder:s.t("find-replace.dialog.replace-placeholder"),value:le,onChange:m=>Se(m)})}),h.jsx(f.FormLayout,{label:s.t("find-replace.dialog.find-direction.title"),children:h.jsx(f.Select,{value:he,options:De,onChange:ye})}),h.jsx(f.FormDualColumnLayout,{children:h.jsxs(c.Fragment,{children:[h.jsx(f.FormLayout,{label:s.t("find-replace.dialog.find-scope.title"),children:h.jsx(f.Select,{value:pe,options:Fe,onChange:xe})}),h.jsx(f.FormLayout,{label:s.t("find-replace.dialog.find-by.title"),children:h.jsx(f.Select,{value:fe,options:Oe,onChange:Ie})})]})}),h.jsx(f.FormDualColumnLayout,{children:h.jsxs(c.Fragment,{children:[h.jsx(f.FormLayout,{children:h.jsx(f.Checkbox,{checked:de,onChange:m=>{t.changeCaseSensitive(m)},children:s.t("find-replace.dialog.case-sensitive")})}),h.jsx(f.FormLayout,{children:h.jsx(f.Checkbox,{checked:ue,onChange:m=>{t.changeMatchesTheWholeCell(m)},children:s.t("find-replace.dialog.match-the-whole-cell")})})]})}),h.jsxs("div",{className:E.findReplaceButtonsGroup,children:[h.jsx(f.Button,{type:"primary",onClick:Re,disabled:_e,children:s.t("find-replace.dialog.find")}),h.jsxs("span",{className:E.findReplaceButtonsGroupRight,children:[h.jsx(f.Button,{disabled:ge,onClick:be,children:s.t("find-replace.dialog.replace")}),h.jsx(f.Button,{disabled:me,onClick:Me,children:s.t("find-replace.dialog.replace-all")})]})]})]})});function tt(){const i=o.useDependency(R),e=o.useDependency(p.ILayoutService),n=o.useDependency(o.IContextService),t=p.useObservable(i.state$,void 0,!0),s=c.useRef(null);c.useEffect(()=>{let u;return s.current&&(u=e.registerContainerElement(s.current)),()=>u==null?void 0:u.dispose()},[e]);const r=c.useRef(null),a=c.useCallback(u=>n.setContextValue(ie,u),[n]),d=c.useCallback(u=>n.setContextValue(te,u),[n]);return c.useEffect(()=>{var S;const u=v.fromEvent(document,"focusin").subscribe(_=>{var g;_.target&&((g=s.current)!=null&&g.contains(_.target))?a(!0):a(!1),!r.current||!r.current.selectHasFocus()?d(!0):d(!1)});return(S=r.current)==null||S.focus(),a(!0),d(!0),()=>{u.unsubscribe(),a(!1)}},[a,d]),h.jsx("div",{className:E.findReplaceDialogContainer,ref:s,children:t.replaceRevealed?h.jsx(et,{ref:r}):h.jsx(Xe,{ref:r})})}function it(i){const e=i.getCurrentLocale();return c.useMemo(()=>[{label:i.t("find-replace.dialog.find-scope.current-sheet"),value:P.SUBUNIT},{label:i.t("find-replace.dialog.find-scope.workbook"),value:P.UNIT}],[e])}function nt(i){const e=i.getCurrentLocale();return c.useMemo(()=>[{label:i.t("find-replace.dialog.find-direction.row"),value:O.ROW},{label:i.t("find-replace.dialog.find-direction.column"),value:O.COLUMN}],[e])}function st(i){const e=i.getCurrentLocale();return c.useMemo(()=>[{label:i.t("find-replace.dialog.find-by.value"),value:T.VALUE},{label:i.t("find-replace.dialog.find-by.formula"),value:T.FORMULA}],[e])}function F(i){return i.getContextValue(ie)}function rt(i){return i.getContextValue(ne)}function oe(i){return i.getContextValue(te)}const L="7_find-replace-shortcuts";function K(i){return i.getContextValue(o.FOCUSING_SHEET)}function q(i){return!i.getContextValue(o.EDITOR_ACTIVATED)}const at={id:x.id,description:"find-replace.shortcut.open-find-dialog",binding:p.KeyCode.F|p.MetaKeys.CTRL_COMMAND,group:L,preconditions(i){return!F(i)&&K(i)&&q(i)}},ot={id:x.id,description:"find-replace.shortcut.open-find-dialog",binding:p.KeyCode.F|p.MetaKeys.CTRL_COMMAND,mac:p.KeyCode.F|p.MetaKeys.MAC_CTRL,preconditions(i){return!F(i)&&K(i)&&q(i)}},ct={id:N.id,description:"find-replace.shortcut.open-replace-dialog",binding:p.KeyCode.H|p.MetaKeys.CTRL_COMMAND,mac:p.KeyCode.H|p.MetaKeys.MAC_CTRL,group:L,preconditions(i){return K(i)&&q(i)&&(!F(i)||!rt(i))}},lt={id:V.id,description:"find-replace.shortcut.go-to-next-match",binding:p.KeyCode.ENTER,group:L,priority:1e3,preconditions(i){return oe(i)&&F(i)}},dt={id:H.id,description:"find-replace.shortcut.go-to-previous-match",binding:p.KeyCode.ENTER|p.MetaKeys.SHIFT,group:L,priority:1e3,preconditions(i){return oe(i)&&F(i)}};function ut(i){const e=i.get(o.IContextService);return{id:x.id,icon:"SearchIcon",tooltip:"find-replace.toolbar",type:p.MenuItemType.BUTTON,hidden$:p.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 ht={[p.RibbonStartGroup.OTHERS]:{[x.id]:{order:2,menuItemFactory:ut}}};var pt=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,_t=(i,e,n,t)=>{for(var s=t>1?void 0:t?ft(e,n):e,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=(t?a(e,n,s):a(s))||s);return t&&s&&pt(e,n,s),s},M=(i,e)=>(n,t)=>e(n,t,i);const Y="DESKTOP_FIND_REPLACE_DIALOG",ce=350,gt=20,mt=-90;exports.FindReplaceController=class extends o.RxDisposable{constructor(n,t,s,r,a,d,u,S,_,g){super();l(this,"_closingListenerDisposable");this._univerInstanceService=n,this._menuManagerService=t,this._shortcutService=s,this._commandService=r,this._findReplaceService=a,this._dialogService=d,this._layoutService=u,this._localeService=S,this._componentManager=_,this._injector=g,this._initCommands(),this._initUI(),this._initShortcuts()}dispose(){var n;super.dispose(),(n=this._closingListenerDisposable)==null||n.dispose(),this._closingListenerDisposable=null}_initCommands(){[x,N,V,H,G,W].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initShortcuts(){[ct,at,ot,dt,lt].forEach(n=>this.disposeWithMe(this._shortcutService.registerShortcut(n)))}_initUI(){this.disposeWithMe(this._componentManager.register("FindReplaceDialog",tt)),this.disposeWithMe(this._componentManager.register("SearchIcon",ee)),this._menuManagerService.mergeMenu(ht),this._findReplaceService.stateUpdates$.pipe(v.takeUntil(this.dispose$)).subscribe(n=>{n.revealed===!0&&this._openPanel()})}_openPanel(){this._dialogService.open({id:Y,draggable:!0,width:ce,title:{title:this._localeService.t("find-replace.dialog.title")},children:{label:"FindReplaceDialog"},destroyOnClose:!0,defaultPosition:vt(),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(Y),this._findReplaceService.terminate(),queueMicrotask(()=>this._layoutService.focus()))}};exports.FindReplaceController=_t([M(0,o.IUniverInstanceService),M(1,p.IMenuManagerService),M(2,p.IShortcutService),M(3,o.ICommandService),M(4,R),M(5,p.IDialogService),M(6,p.ILayoutService),M(7,o.Inject(o.LocaleService)),M(8,o.Inject(p.ComponentManager)),M(9,o.Inject(o.Injector))],exports.FindReplaceController);function vt(){const{innerWidth:i}=window;return{x:(i-ce)/2-gt,y:mt}}var St=Object.defineProperty,Ct=Object.getOwnPropertyDescriptor,Rt=(i,e,n,t)=>{for(var s=t>1?void 0:t?Ct(e,n):e,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=(t?a(e,n,s):a(s))||s);return t&&s&&St(e,n,s),s},Z=(i,e)=>(n,t)=>e(n,t,i);const bt="UNIVER_FIND_REPLACE_PLUGIN";var A;exports.UniverFindReplacePlugin=(A=class extends o.Plugin{constructor(e=Le,n,t){super(),this._config=e,this._injector=n,this._configService=t;const{...s}=this._config;this._configService.setConfig(Ne,s)}onStarting(){[[exports.FindReplaceController],[R,{useClass:B}]].forEach(e=>this._injector.add(e))}onRendered(){this._injector.get(exports.FindReplaceController)}},l(A,"pluginName",bt),A);exports.UniverFindReplacePlugin=Rt([Z(1,o.Inject(o.Injector)),Z(2,o.IConfigService)],exports.UniverFindReplacePlugin);exports.FindBy=T;exports.FindDirection=O;exports.FindModel=We;exports.FindScope=P;exports.GoToNextMatchOperation=V;exports.GoToPreviousMatchOperation=H;exports.IFindReplaceService=R;exports.OpenFindDialogOperation=x;exports.OpenReplaceDialogOperation=N;exports.ReplaceAllMatchesCommand=G;exports.ReplaceCurrentMatchCommand=W;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e={"find-replace":{toolbar:"Rechercher & Remplacer",shortcut:{"open-find-dialog":"Ouvrir la boîte de dialogue Rechercher","open-replace-dialog":"Ouvrir la boîte de dialogue Remplacer","close-dialog":"Fermer la boîte de dialogue Rechercher & Remplacer","go-to-next-match":"Aller à la correspondance suivante","go-to-previous-match":"Aller à la correspondance précédente"},dialog:{title:"Rechercher",find:"Rechercher",replace:"Remplacer","replace-all":"Remplacer tout","case-sensitive":"Sensible à la casse","find-placeholder":"Rechercher dans cette feuille","advanced-finding":"Recherche avancée & Remplacer","replace-placeholder":"Entrer la chaîne de remplacement","match-the-whole-cell":"Correspondre à toute la cellule","find-direction":{title:"Direction de recherche",row:"Rechercher par ligne",column:"Rechercher par colonne"},"find-scope":{title:"Plage de recherche","current-sheet":"Feuille actuelle",workbook:"Classeur"},"find-by":{title:"Rechercher par",value:"Rechercher par valeur",formula:"Rechercher par formule"},"no-match":"Recherche terminée mais aucune correspondance trouvée.","no-result":"Aucun résultat"},replace:{"all-success":"Remplacé toutes les {0} correspondances","all-failure":"Échec du remplacement",confirm:{title:"Êtes-vous sûr de vouloir remplacer toutes les correspondances?"}}},"find-replace-shortcuts":"Rechercher & Remplacer"};module.exports=e;
|