@univerjs/sheets-formula-ui 0.6.4 → 0.6.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/cjs/index.js CHANGED
@@ -20,4 +20,4 @@
20
20
  `,children:o}),v.jsx("div",{className:it.formulaFunctionParamsDetail,children:n})]})}const Wr="univer-formula-input-params-list",Vr="univer-formula-input-params-list-item-name",Br="univer-formula-input-params-list-item-selector",we={formulaInputParamsList:Wr,formulaInputParamsListItemName:Vr,formulaInputParamsListItemSelector:Br};function Kr(e){const{functionInfo:t,onChange:n}=e;if(!t)return null;const[o,r]=S.useState([]),[s,i]=S.useState(t.functionParameter),[c,d]=S.useState(-1);return v.jsxs("div",{className:we.formulaInputParams,children:[v.jsx("div",{className:we.formulaInputParamsList,children:s.map((h,f)=>v.jsxs("div",{children:[v.jsx("div",{className:we.formulaInputParamsListItemName,children:h.name}),v.jsx("div",{className:we.formulaInputParamsListItemSelector})]},f))}),v.jsx("div",{className:we.formulaInputParamsInfo,children:v.jsx(ke,{title:c===-1?v.jsx(Zt,{prefix:t.functionName,value:s}):s[c].name,value:c===-1?t.description:s[c].detail})})]})}const qr="univer-formula-select-function-select",Yr="univer-formula-select-function-result",zr="univer-formula-select-function-result-item",Gr="univer-formula-select-function-result-item-name-light",Zr="univer-formula-select-function-result-item-selected",Xr="univer-formula-select-function-result-item-active",Jr="univer-formula-select-function-content",fe={formulaSelectFunctionSelect:qr,formulaSelectFunctionResult:Yr,formulaSelectFunctionResultItem:zr,formulaSelectFunctionResultItemNameLight:Gr,formulaSelectFunctionResultItemSelected:Zr,formulaSelectFunctionResultItemActive:Xr,formulaSelectFunctionContent:Jr};function Qr(e){const{onChange:t}=e,n="-1",[o,r]=S.useState(""),[s,i]=S.useState([]),[c,d]=S.useState(0),[h,f]=S.useState(n),[p,u]=S.useState(0),[g,m]=S.useState(null),T=a.useDependency(ye.IDescriptionService),C=a.useDependency(l.LocaleService),R=a.useDependency(a.ISidebarService),I=a.useObservable(R.sidebarOptions$),E=Nn(F.FunctionType,C);E.unshift({label:C.t("formula.moreFunctions.allFunctions"),value:n});const _=C.t("formula.prompt.required"),x=C.t("formula.prompt.optional");S.useEffect(()=>{L(n)},[]),S.useEffect(()=>{$(0)},[s]),S.useEffect(()=>{I!=null&&I.visible&&(r(""),i([]),d(0),f(n),u(0),m(null),L(n))},[I]);const N=M=>{if(o.trim()==="")return M;const b=new RegExp(`(${o.toLocaleUpperCase()})`);return M.split(b).filter(Boolean).map((k,H)=>k.match(b)?v.jsx("span",{className:fe.formulaSelectFunctionResultItemNameLight,children:k},H):k)},$=M=>{if(s.length===0){m(null);return}u(M);const b=T.getFunctionInfo(s[M].name);if(!b){m(null);return}m(b),t(b)};function L(M){f(M);const b=T.getSearchListByType(+M);i(b)}function P(M){r(M);const b=T.getSearchListByName(M);i(b)}function y(M){if(M.stopPropagation(),M.key==="ArrowDown"){const b=c+1;d(b===s.length?0:b)}else if(M.key==="ArrowUp"){const b=c-1;d(b===-1?s.length-1:b)}else M.key==="Enter"&&$(c)}const O=M=>{d(M)},D=()=>{d(-1)};return v.jsxs("div",{children:[v.jsxs("div",{className:fe.formulaSelectFunctionSelect,children:[v.jsx(te.Select,{value:h,options:E,onChange:L}),v.jsx(te.Input,{placeholder:C.t("formula.moreFunctions.searchFunctionPlaceholder"),onKeyDown:y,value:o,onChange:P,size:"small",allowClear:!0})]}),v.jsx("ul",{className:fe.formulaSelectFunctionResult,onKeyDown:y,tabIndex:-1,children:s.map(({name:M},b)=>v.jsxs("li",{className:c===b?`
21
21
  ${fe.formulaSelectFunctionResultItem}
22
22
  ${fe.formulaSelectFunctionResultItemActive}
23
- `:fe.formulaSelectFunctionResultItem,onMouseEnter:()=>O(b),onMouseLeave:D,onClick:()=>$(b),children:[p===b&&v.jsx(jt,{className:fe.formulaSelectFunctionResultItemSelected}),v.jsx("span",{className:fe.formulaSelectFunctionResultItemName,children:N(M)})]},b))}),g&&v.jsxs("div",{className:fe.formulaSelectFunctionContent,children:[v.jsx(ke,{title:g.functionName,value:g.description}),v.jsx(ke,{title:C.t("formula.moreFunctions.syntax"),value:v.jsx(Zt,{prefix:g.functionName,value:g.functionParameter})}),v.jsx(ke,{title:C.t("formula.prompt.helpExample"),value:`${g.functionName}(${g.functionParameter.map(M=>M.example).join(",")})`}),g.functionParameter&&g.functionParameter.map(M=>v.jsx(ke,{title:M.name,value:`${M.require?_:x} ${M.detail}`},M.name))]})]})}function es(){const e=w.useActiveWorkbook(),[t,n]=S.useState(!0),[o,r]=S.useState(!1),[s,i]=S.useState(null);a.useDependency(w.IEditorBridgeService);const c=a.useDependency(l.LocaleService),d=a.useDependency(z.IEditorService),h=a.useDependency(l.IUniverInstanceService),f=a.useDependency(l.ICommandService);function p(){n(!t),r(!o)}function u(){const g=j.getSheetCommandTarget(h);if(!g)return;f.executeCommand(w.SetCellEditVisibleOperation.id,{visible:!0,unitId:g.unitId,eventType:V.DeviceInputEventType.Dblclick});const m=d.getEditor(l.DOCS_NORMAL_EDITOR_UNIT_ID_KEY),T=d.getEditor(l.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY),C=`=${s==null?void 0:s.functionName}(`;m==null||m.replaceText(C),T==null||T.replaceText(C,!1)}return v.jsxs("div",{className:Mt.formulaMoreFunctions,children:[t&&v.jsx(Qr,{onChange:i}),o&&v.jsx(Kr,{functionInfo:s,onChange:()=>{}}),v.jsxs("div",{className:Mt.formulaMoreFunctionsOperation,children:[o&&v.jsx(te.Button,{type:"primary",size:"small",onClick:p,children:c.t("formula.moreFunctions.next")}),o&&v.jsx(te.Button,{size:"small",onClick:p,children:c.t("formula.moreFunctions.prev")}),t&&!!e&&v.jsx(te.Button,{type:"primary",size:"small",onClick:u,children:c.t("formula.moreFunctions.confirm")})]})]})}function ts(e){return{id:Je.id,icon:"FunctionSingle",tooltip:"formula.insert.tooltip",type:a.MenuItemType.SELECTOR,selections:[{label:{name:"SUM",selectable:!1},value:"SUM",icon:"SumSingle"},{label:{name:"AVERAGE",selectable:!1},value:"AVERAGE",icon:"AvgSingle"},{label:{name:"COUNT",selectable:!1},value:"COUNT",icon:"CntSingle"},{label:{name:"MAX",selectable:!1},value:"MAX",icon:"MaxSingle"},{label:{name:"MIN",selectable:!1},value:"MIN",icon:"MinSingle"}],hidden$:a.getMenuHiddenObservable(e,l.UniverInstanceType.UNIVER_SHEET),disabled$:w.getCurrentRangeDisable$(e,{workbookTypes:[j.WorkbookEditablePermission],worksheetTypes:[j.WorksheetEditPermission,j.WorksheetSetCellValuePermission],rangeTypes:[j.RangeProtectionPermissionEditPoint]})}}function ns(e){return{id:Qe.id,title:"formula.insert.more",type:a.MenuItemType.BUTTON}}function os(e){return e.get(l.IUniverInstanceService).getCurrentTypeOfUnit$(l.UniverInstanceType.UNIVER_SHEET).pipe(B.switchMap(o=>o&&e.get(a.IClipboardInterfaceService)?new B.Observable(s=>s.next(!e.get(a.IClipboardInterfaceService).supportClipboard)):B.of(!0)))}function rs(e){return{id:Xe.id,type:a.MenuItemType.BUTTON,title:"formula.operation.pasteFormula",disabled$:os(e).pipe(B.combineLatestWith(w.getCurrentRangeDisable$(e,{workbookTypes:[j.WorkbookEditablePermission],rangeTypes:[j.RangeProtectionPermissionEditPoint],worksheetTypes:[j.WorksheetSetCellValuePermission,j.WorksheetEditPermission]})),B.map(([t,n])=>t||n))}}const ss={[a.RibbonStartGroup.FORMULAS_INSERT]:{[Je.id]:{order:1,menuItemFactory:ts,[Qe.id]:{order:1,menuItemFactory:ns}}},[w.PASTE_SPECIAL_MENU_ID]:{[Xe.id]:{order:4,menuItemFactory:rs}}},is="meta_key_ctrl_And_Shift",tt=[a.KeyCode.ARROW_DOWN,a.KeyCode.ARROW_UP,a.KeyCode.ARROW_LEFT,a.KeyCode.ARROW_RIGHT],cs=[...tt,a.KeyCode.ENTER,a.KeyCode.TAB,a.KeyCode.ESC];function as(){const e=[];for(const t of cs)e.push({id:Te.id,binding:t,preconditions:n=>w.whenFormulaEditorActivated(n),staticParameters:{eventType:V.DeviceInputEventType.Keyboard,keycode:t}});return e}function ls(){const e=[];for(const t of tt)e.push({id:Te.id,binding:t|a.MetaKeys.SHIFT,preconditions:n=>w.whenFormulaEditorActivated(n),staticParameters:{eventType:V.DeviceInputEventType.Keyboard,keycode:t,metaKey:a.MetaKeys.SHIFT}});return e}function us(){const e=[];for(const t of tt)e.push({id:Te.id,binding:t|a.MetaKeys.CTRL_COMMAND,preconditions:n=>w.whenFormulaEditorActivated(n),staticParameters:{eventType:V.DeviceInputEventType.Keyboard,keycode:t,metaKey:a.MetaKeys.CTRL_COMMAND}});return e}function ds(){const e=[];for(const t of tt)e.push({id:Te.id,binding:t|a.MetaKeys.SHIFT|a.MetaKeys.CTRL_COMMAND,preconditions:n=>w.whenFormulaEditorActivated(n),staticParameters:{eventType:V.DeviceInputEventType.Keyboard,keycode:t,metaKey:is}});return e}const fs={id:ut.id,binding:a.KeyCode.F4,preconditions:e=>w.whenFormulaEditorActivated(e)};function hs(){const e=[];for(const t of[a.KeyCode.ENTER,a.KeyCode.TAB,a.KeyCode.ARROW_DOWN,a.KeyCode.ARROW_UP])e.push({id:Te.id,binding:t,preconditions:n=>Wo(n),staticParameters:{eventType:V.DeviceInputEventType.Keyboard,keycode:t,isSingleEditor:!0}});return e}var ms=Object.getOwnPropertyDescriptor,gs=(e,t,n,o)=>{for(var r=o>1?void 0:o?ms(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(r=i(r)||r);return r},_e=(e,t)=>(n,o)=>t(n,o,e);let Ze=class extends l.Disposable{constructor(e,t,n,o,r,s,i){super(),this._injector=e,this._menuManagerService=t,this._commandService=n,this._shortcutService=o,this._uiPartsService=r,this._renderManagerService=s,this._componentManager=i,this._initialize()}_initialize(){this._registerCommands(),this._registerMenus(),this._registerShortcuts(),this._registerComponents(),this._registerRenderModules()}_registerMenus(){this._menuManagerService.mergeMenu(ss)}_registerCommands(){[Xe,Je,Qe,wt,At,Te,ut].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_registerShortcuts(){[...as(),...ls(),...us(),...ds(),...hs(),fs].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}_registerComponents(){this.disposeWithMe(this._uiPartsService.registerComponent(a.BuiltInUIPart.CONTENT,()=>a.connectInjector(wr,this._injector))),this.disposeWithMe(this._uiPartsService.registerComponent(w.SheetsUIPart.FORMULA_AUX,()=>a.connectInjector(ur,this._injector))),this._componentManager.register(Lt,es)}_registerRenderModules(){this.disposeWithMe(this._renderManagerService.registerRenderModule(l.UniverInstanceType.UNIVER_SHEET,[ze]))}};Ze=gs([_e(0,l.Inject(l.Injector)),_e(1,a.IMenuManagerService),_e(2,l.ICommandService),_e(3,a.IShortcutService),_e(4,a.IUIPartsService),_e(5,V.IRenderManagerService),_e(6,l.Inject(a.ComponentManager))],Ze);const ps=()=>{var o,r;const e=a.useDependency(gt),t=a.useObservable(e.currentSelector$),n=S.useRef(null);return S.useEffect(()=>{var s,i;if(t)return(i=n.current)==null||i.showDialog((s=t.initialValue)!=null?s:[]),()=>{var c;(c=n.current)==null||c.hideDialog()}},[t]),v.jsx(mt,{unitId:(o=t==null?void 0:t.unitId)!=null?o:"",subUnitId:(r=t==null?void 0:t.subUnitId)!=null?r:"",hideEditor:!0,selectorRef:n,onChange:(s,i)=>{var c;t==null||t.callback((c=i==null?void 0:i.split(",").map(d=>F.deserializeRangeWithSheet(d)))!=null?c:[])}})};var Ss=Object.defineProperty,vs=Object.getOwnPropertyDescriptor,Cs=(e,t,n)=>t in e?Ss(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Is=(e,t,n,o)=>{for(var r=o>1?void 0:o?vs(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(r=i(r)||r);return r},Be=(e,t)=>(n,o)=>t(n,o,e),Xt=(e,t,n)=>Cs(e,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsFormulaUIPlugin=class extends l.Plugin{constructor(t=xt,n,o,r,s){super(),this._config=t,this._injector=n,this._renderManagerService=o,this._configService=r,this._uiPartsService=s;const{menu:i,...c}=l.merge(xt,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Uo,c,{merge:!0})}onStarting(){const t=this._injector;[[je,{useClass:ct}],[gt],[Ze],[qe],[Ye],[ze],[Ge]].forEach(r=>t.add(r));const o=this._injector.get(a.ComponentManager);o.register(w.RANGE_SELECTOR_COMPONENT_KEY,mt),o.register(w.EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY,Yt),this._initUIPart()}onRendered(){[[exports.RefSelectionsRenderService],[lt]].forEach(t=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(l.UniverInstanceType.UNIVER_SHEET,t))}),l.touchDependencies(this._injector,[[Ze],[Ye],[Ge]])}onSteady(){this._injector.get(qe)}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(a.BuiltInUIPart.GLOBAL,()=>a.connectInjector(ps,this._injector)))}};Xt(exports.UniverSheetsFormulaUIPlugin,"pluginName",Pt);Xt(exports.UniverSheetsFormulaUIPlugin,"type",l.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsFormulaUIPlugin=Is([l.DependentOn(F.UniverFormulaEnginePlugin,ye.UniverSheetsFormulaPlugin),Be(1,l.Inject(l.Injector)),Be(2,V.IRenderManagerService),Be(3,l.IConfigService),Be(4,a.IUIPartsService)],exports.UniverSheetsFormulaUIPlugin);exports.FORMULA_PROMPT_ACTIVATED=Ot;exports.FormulaEditor=Yt;exports.GlobalRangeSelectorService=gt;exports.HelpFunctionOperation=At;exports.InsertFunctionOperation=Je;exports.MoreFunctionsOperation=Qe;exports.RangeSelector=mt;exports.ReferenceAbsoluteOperation=ut;exports.SearchFunctionOperation=wt;exports.SelectEditorFormulaOperation=Te;exports.SheetOnlyPasteFormulaCommand=Xe;
23
+ `:fe.formulaSelectFunctionResultItem,onMouseEnter:()=>O(b),onMouseLeave:D,onClick:()=>$(b),children:[p===b&&v.jsx(jt,{className:fe.formulaSelectFunctionResultItemSelected}),v.jsx("span",{className:fe.formulaSelectFunctionResultItemName,children:N(M)})]},b))}),g&&v.jsxs("div",{className:fe.formulaSelectFunctionContent,children:[v.jsx(ke,{title:g.functionName,value:g.description}),v.jsx(ke,{title:C.t("formula.moreFunctions.syntax"),value:v.jsx(Zt,{prefix:g.functionName,value:g.functionParameter})}),v.jsx(ke,{title:C.t("formula.prompt.helpExample"),value:`${g.functionName}(${g.functionParameter.map(M=>M.example).join(",")})`}),g.functionParameter&&g.functionParameter.map(M=>v.jsx(ke,{title:M.name,value:`${M.require?_:x} ${M.detail}`},M.name))]})]})}function es(){const e=w.useActiveWorkbook(),[t,n]=S.useState(!0),[o,r]=S.useState(!1),[s,i]=S.useState(null);a.useDependency(w.IEditorBridgeService);const c=a.useDependency(l.LocaleService),d=a.useDependency(z.IEditorService),h=a.useDependency(l.IUniverInstanceService),f=a.useDependency(l.ICommandService);function p(){n(!t),r(!o)}function u(){const g=j.getSheetCommandTarget(h);if(!g)return;f.executeCommand(w.SetCellEditVisibleOperation.id,{visible:!0,unitId:g.unitId,eventType:V.DeviceInputEventType.Dblclick});const m=d.getEditor(l.DOCS_NORMAL_EDITOR_UNIT_ID_KEY),T=d.getEditor(l.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY),C=`=${s==null?void 0:s.functionName}(`;m==null||m.replaceText(C),T==null||T.replaceText(C,!1)}return v.jsxs("div",{className:Mt.formulaMoreFunctions,children:[t&&v.jsx(Qr,{onChange:i}),o&&v.jsx(Kr,{functionInfo:s,onChange:()=>{}}),v.jsxs("div",{className:Mt.formulaMoreFunctionsOperation,children:[o&&v.jsx(te.Button,{type:"primary",size:"small",onClick:p,children:c.t("formula.moreFunctions.next")}),o&&v.jsx(te.Button,{size:"small",onClick:p,children:c.t("formula.moreFunctions.prev")}),t&&!!e&&v.jsx(te.Button,{type:"primary",size:"small",onClick:u,children:c.t("formula.moreFunctions.confirm")})]})]})}function ts(e){return{id:Je.id,icon:"FunctionSingle",tooltip:"formula.insert.tooltip",type:a.MenuItemType.SELECTOR,selections:[{label:{name:"SUM",selectable:!1},value:"SUM",icon:"SumSingle"},{label:{name:"AVERAGE",selectable:!1},value:"AVERAGE",icon:"AvgSingle"},{label:{name:"COUNT",selectable:!1},value:"COUNT",icon:"CntSingle"},{label:{name:"MAX",selectable:!1},value:"MAX",icon:"MaxSingle"},{label:{name:"MIN",selectable:!1},value:"MIN",icon:"MinSingle"}],hidden$:a.getMenuHiddenObservable(e,l.UniverInstanceType.UNIVER_SHEET),disabled$:w.getCurrentRangeDisable$(e,{workbookTypes:[j.WorkbookEditablePermission],worksheetTypes:[j.WorksheetEditPermission,j.WorksheetSetCellValuePermission],rangeTypes:[j.RangeProtectionPermissionEditPoint]})}}function ns(e){return{id:Qe.id,title:"formula.insert.more",type:a.MenuItemType.BUTTON}}function os(e){return e.get(l.IUniverInstanceService).getCurrentTypeOfUnit$(l.UniverInstanceType.UNIVER_SHEET).pipe(B.switchMap(o=>o&&e.get(a.IClipboardInterfaceService)?new B.Observable(s=>s.next(!e.get(a.IClipboardInterfaceService).supportClipboard)):B.of(!0)))}function rs(e){return{id:Xe.id,type:a.MenuItemType.BUTTON,title:"formula.operation.pasteFormula",disabled$:os(e).pipe(B.combineLatestWith(w.getCurrentRangeDisable$(e,{workbookTypes:[j.WorkbookEditablePermission],rangeTypes:[j.RangeProtectionPermissionEditPoint],worksheetTypes:[j.WorksheetSetCellValuePermission,j.WorksheetEditPermission]})),B.map(([t,n])=>t||n))}}const ss={[a.RibbonStartGroup.FORMULAS_INSERT]:{[Je.id]:{order:1,menuItemFactory:ts,[Qe.id]:{order:1,menuItemFactory:ns}}},[w.PASTE_SPECIAL_MENU_ID]:{[Xe.id]:{order:4,menuItemFactory:rs}}},is="meta_key_ctrl_And_Shift",tt=[a.KeyCode.ARROW_DOWN,a.KeyCode.ARROW_UP,a.KeyCode.ARROW_LEFT,a.KeyCode.ARROW_RIGHT],cs=[...tt,a.KeyCode.ENTER,a.KeyCode.TAB,a.KeyCode.ESC];function as(){const e=[];for(const t of cs)e.push({id:Te.id,binding:t,preconditions:n=>w.whenFormulaEditorActivated(n),staticParameters:{eventType:V.DeviceInputEventType.Keyboard,keycode:t}});return e}function ls(){const e=[];for(const t of tt)e.push({id:Te.id,binding:t|a.MetaKeys.SHIFT,preconditions:n=>w.whenFormulaEditorActivated(n),staticParameters:{eventType:V.DeviceInputEventType.Keyboard,keycode:t,metaKey:a.MetaKeys.SHIFT}});return e}function us(){const e=[];for(const t of tt)e.push({id:Te.id,binding:t|a.MetaKeys.CTRL_COMMAND,preconditions:n=>w.whenFormulaEditorActivated(n),staticParameters:{eventType:V.DeviceInputEventType.Keyboard,keycode:t,metaKey:a.MetaKeys.CTRL_COMMAND}});return e}function ds(){const e=[];for(const t of tt)e.push({id:Te.id,binding:t|a.MetaKeys.SHIFT|a.MetaKeys.CTRL_COMMAND,preconditions:n=>w.whenFormulaEditorActivated(n),staticParameters:{eventType:V.DeviceInputEventType.Keyboard,keycode:t,metaKey:is}});return e}const fs={id:ut.id,binding:a.KeyCode.F4,preconditions:e=>w.whenFormulaEditorActivated(e)};function hs(){const e=[];for(const t of[a.KeyCode.ENTER,a.KeyCode.TAB,a.KeyCode.ARROW_DOWN,a.KeyCode.ARROW_UP])e.push({id:Te.id,binding:t,preconditions:n=>Wo(n),staticParameters:{eventType:V.DeviceInputEventType.Keyboard,keycode:t,isSingleEditor:!0}});return e}var ms=Object.getOwnPropertyDescriptor,gs=(e,t,n,o)=>{for(var r=o>1?void 0:o?ms(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(r=i(r)||r);return r},_e=(e,t)=>(n,o)=>t(n,o,e);let Ze=class extends l.Disposable{constructor(e,t,n,o,r,s,i){super(),this._injector=e,this._menuManagerService=t,this._commandService=n,this._shortcutService=o,this._uiPartsService=r,this._renderManagerService=s,this._componentManager=i,this._initialize()}_initialize(){this._registerCommands(),this._registerMenus(),this._registerShortcuts(),this._registerComponents(),this._registerRenderModules()}_registerMenus(){this._menuManagerService.mergeMenu(ss)}_registerCommands(){[Xe,Je,Qe,wt,At,Te,ut].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_registerShortcuts(){[...as(),...ls(),...us(),...ds(),...hs(),fs].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}_registerComponents(){this.disposeWithMe(this._uiPartsService.registerComponent(a.BuiltInUIPart.CONTENT,()=>a.connectInjector(wr,this._injector))),this.disposeWithMe(this._uiPartsService.registerComponent(w.SheetsUIPart.FORMULA_AUX,()=>a.connectInjector(ur,this._injector))),this._componentManager.register(Lt,es)}_registerRenderModules(){this.disposeWithMe(this._renderManagerService.registerRenderModule(l.UniverInstanceType.UNIVER_SHEET,[ze]))}};Ze=gs([_e(0,l.Inject(l.Injector)),_e(1,a.IMenuManagerService),_e(2,l.ICommandService),_e(3,a.IShortcutService),_e(4,a.IUIPartsService),_e(5,V.IRenderManagerService),_e(6,l.Inject(a.ComponentManager))],Ze);const ps=()=>{var o,r;const e=a.useDependency(gt),t=a.useObservable(e.currentSelector$),n=S.useRef(null);return S.useEffect(()=>{var s,i;if(t)return(i=n.current)==null||i.showDialog((s=t.initialValue)!=null?s:[]),()=>{var c;(c=n.current)==null||c.hideDialog()}},[t]),v.jsx(mt,{unitId:(o=t==null?void 0:t.unitId)!=null?o:"",subUnitId:(r=t==null?void 0:t.subUnitId)!=null?r:"",hideEditor:!0,selectorRef:n,onChange:(s,i)=>{var c;t==null||t.callback((c=i==null?void 0:i.split(",").map(d=>F.deserializeRangeWithSheet(d)))!=null?c:[])}})};var Ss=Object.defineProperty,vs=Object.getOwnPropertyDescriptor,Cs=(e,t,n)=>t in e?Ss(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Is=(e,t,n,o)=>{for(var r=o>1?void 0:o?vs(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(r=i(r)||r);return r},Be=(e,t)=>(n,o)=>t(n,o,e),Xt=(e,t,n)=>Cs(e,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsFormulaUIPlugin=class extends l.Plugin{constructor(t=xt,n,o,r,s){super(),this._config=t,this._injector=n,this._renderManagerService=o,this._configService=r,this._uiPartsService=s;const{menu:i,...c}=l.merge(xt,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Uo,c,{merge:!0})}onStarting(){l.registerDependencies(this._injector,[[je,{useClass:ct}],[gt],[Ze],[qe],[Ye],[ze],[Ge]])}onRendered(){[[exports.RefSelectionsRenderService],[lt]].forEach(t=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(l.UniverInstanceType.UNIVER_SHEET,t))}),l.touchDependencies(this._injector,[[Ze],[Ye],[Ge]]),this._initUIPart()}onSteady(){this._injector.get(qe)}_initUIPart(){const t=this._injector.get(a.ComponentManager);this.disposeWithMe(t.register(w.RANGE_SELECTOR_COMPONENT_KEY,mt)),this.disposeWithMe(t.register(w.EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY,Yt)),this.disposeWithMe(this._uiPartsService.registerComponent(a.BuiltInUIPart.GLOBAL,()=>a.connectInjector(ps,this._injector)))}};Xt(exports.UniverSheetsFormulaUIPlugin,"pluginName",Pt);Xt(exports.UniverSheetsFormulaUIPlugin,"type",l.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsFormulaUIPlugin=Is([l.DependentOn(F.UniverFormulaEnginePlugin,ye.UniverSheetsFormulaPlugin),Be(1,l.Inject(l.Injector)),Be(2,V.IRenderManagerService),Be(3,l.IConfigService),Be(4,a.IUIPartsService)],exports.UniverSheetsFormulaUIPlugin);exports.FORMULA_PROMPT_ACTIVATED=Ot;exports.FormulaEditor=Yt;exports.GlobalRangeSelectorService=gt;exports.HelpFunctionOperation=At;exports.InsertFunctionOperation=Je;exports.MoreFunctionsOperation=Qe;exports.RangeSelector=mt;exports.ReferenceAbsoluteOperation=ut;exports.SearchFunctionOperation=wt;exports.SelectEditorFormulaOperation=Te;exports.SheetOnlyPasteFormulaCommand=Xe;