Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(style): modal show
tonytonychopper123962dcb0c723e
diff --git a/packages/base-render/src/Component/Sheets/SheetSkeleton.ts b/packages/base-render/src/Component/Sheets/SheetSkeleton.tsindex 28df1e7de7..750e4e833b 100644--- a/packages/base-render/src/Component/Sheets/SheetSkeleton.ts+++ b/packages/base-render/src/Component/Sheets/SheetSkeleton.ts@@ -732,7 +732,7 @@ export class SpreadsheetSkeleton extends Skeleton {const documentSkeleton = DocumentSkeleton.create(documentData, this.getContext());if (angle === 0 || wrapStrategy !== WrapStrategy.WRAP) {documentSkeleton.calculate();- console.log(cell.v, documentSkeleton);+ // console.log(cell.v, documentSkeleton);}fontCache.setValue(r, c, {documentSkeleton,diff --git a/packages/base-sheets/src/Basics/Observer.ts b/packages/base-sheets/src/Basics/Observer.tsindex 35e1dad4bf..abc8da1b4a 100644--- a/packages/base-sheets/src/Basics/Observer.ts+++ b/packages/base-sheets/src/Basics/Observer.ts@@ -7,6 +7,7 @@ import { ToolBar } from '../View/UI/ToolBar/ToolBar';import { LineColor } from '../View/UI/Common/Line/LineColor';import { ModalGroup } from '../View/UI/ModalGroup/ModalGroup';import { RichText } from '../View/UI/RichText/RichText';+import { CellRangeModal } from '../View/UI/Common/CellRange/CellRangeModal';interface ISelectionControlFillConfig {}@@ -49,7 +50,7 @@ export type SheetPluginObserve = {onLineColorDidMountObservable: Observable<LineColor>;onSheetContainerDidMountObservable: Observable<SheetContainer>;- // onSheetContainerDidMountObservable: Observable<SheetContainer>;+ onCellRangeModalDidMountObservable: Observable<CellRangeModal>;onSpreadsheetKeyDownObservable: Observable<IKeyboardEvent>;onSpreadsheetKeyUpObservable: Observable<IKeyboardEvent>;@@ -86,6 +87,7 @@ export function uninstall(plugin: Plugin) {plugin.deleteObserve('onChangeCurrentSheetObserver');plugin.deleteObserve('onSheetContainerDidMountObservable');+ plugin.deleteObserve('onCellRangeModalDidMountObservable');plugin.deleteObserve('onSpreadsheetKeyDownObservable');plugin.deleteObserve('onSpreadsheetKeyUpObservable');plugin.deleteObserve('onSpreadsheetKeyCopyObservable');@@ -117,6 +119,7 @@ export function install(plugin: Plugin) {plugin.pushToObserve('onChangeCurrentSheetObserver');plugin.pushToObserve('onToolBarDidMountObservable');+ plugin.pushToObserve('onCellRangeModalDidMountObservable');plugin.pushToObserve('onModalGroupDidMountObservable');plugin.pushToObserve('onRichTextDidMountObservable');plugin.pushToObserve('onFormulaBarDidMountObservable');diff --git a/packages/base-sheets/src/Controller/ModalGroupController.ts b/packages/base-sheets/src/Controller/ModalGroupController.tsindex ae0dfde956..5108f8c41e 100644--- a/packages/base-sheets/src/Controller/ModalGroupController.ts+++ b/packages/base-sheets/src/Controller/ModalGroupController.ts@@ -34,4 +34,9 @@ export class ModalGroupController {this._ModalGroupComponent?.setModalGroup(this._ModalGroup);}}++ getModal(name: string) {+ const ModalGroup = this._ModalGroupComponent.getModalGroup();+ return ModalGroup.find((item) => item.constructor.name === name);+ }}diff --git a/packages/base-sheets/src/Controller/SheetContainerController.ts b/packages/base-sheets/src/Controller/SheetContainerController.tsindex 3d3b0a1ebc..4d5c206d72 100644--- a/packages/base-sheets/src/Controller/SheetContainerController.ts+++ b/packages/base-sheets/src/Controller/SheetContainerController.ts@@ -1,5 +1,6 @@import { BooleanNumber, CommandManager, ISheetActionData, SheetActionBase } from '@univer/core';import { BaseComponentSheet, BaseComponentRender } from '@univer/base-component';+import { CellRangeModal } from '../View/UI/Common/CellRange/CellRangeModal';import { SheetPlugin } from '../SheetPlugin';export class SheetContainerController {@@ -93,6 +94,6 @@ export class SheetContainerController {for (let k in registerIcon) {this._plugin.registerComponent(k, registerIcon[k]);}- // this._plugin.registerModal(CellRangeModal.name, CellRangeModal);+ this._plugin.registerModal(CellRangeModal.name, CellRangeModal);}}diff --git a/packages/base-sheets/src/SheetPlugin.tsx b/packages/base-sheets/src/SheetPlugin.tsxindex e06e800983..44fda21323 100644--- a/packages/base-sheets/src/SheetPlugin.tsx+++ b/packages/base-sheets/src/SheetPlugin.tsx@@ -344,6 +344,10 @@ export class SheetPlugin extends Plugin<SheetPluginObserve, SheetContext> {return this._cellEditorControl;}+ getModalGroupControl() {+ return this._modalGroupController;+ }+addSider(item: ISlotProps): Promise<void> {return this._addSiderFunc(item);}diff --git a/packages/base-sheets/src/View/UI/Common/CellRange/CellRange.tsx b/packages/base-sheets/src/View/UI/Common/CellRange/CellRange.tsxindex 78f972ab74..a651c74e77 100644--- a/packages/base-sheets/src/View/UI/Common/CellRange/CellRange.tsx+++ b/packages/base-sheets/src/View/UI/Common/CellRange/CellRange.tsx@@ -1,7 +1,4 @@import { BaseComponentRender, BaseComponentSheet, Component, createRef, ModalButtonGroup } from '@univer/base-component';-import { PLUGIN_NAMES } from '@univer/core';-import { SheetPlugin } from '../../../..';-import { CellRangeModal } from './CellRangeModal';import styles from './index.module.less';interface CellRangeProps {@@ -51,15 +48,6 @@ export class CellRange extends Component<CellRangeProps, CellRangeState> {});}- showModal() {- const { onTableClick } = this.props;- const sheetPlugin = this._context.getPluginManager().getPluginByName<SheetPlugin>(PLUGIN_NAMES.SPREADSHEET)!;- const cellRangeModal = sheetPlugin.getRegisterComponent(CellRangeModal.name);- console.dir(cellRangeModal);-- onTableClick?.();- }-confirmRange() {const value = this.inputRef.current?.value;@@ -74,14 +62,14 @@ export class CellRange extends Component<CellRangeProps, CellRangeState> {}render() {- const { placeholder, value } = this.props;+ const { placeholder, value, onTableClick } = this.props;const Input = this._render.renderFunction('Input');const TableIcon = this._render.renderFunction('TableIcon');return (- <div className={styles.cellRangeModal}>+ <div className={styles.cellRange}><Input onClick={this.handleClick.bind(this)} placeholder={placeholder} value={value} onChange={this.changeInput}></Input>- <span className={styles.cellModalIcon} onClick={this.showModal.bind(this)}>+ <span className={styles.cellModalIcon} onClick={onTableClick}><TableIcon /></span></div>diff --git a/packages/base-sheets/src/View/UI/Common/CellRange/CellRangeModal.tsx b/packages/base-sheets/src/View/UI/Common/CellRange/CellRangeModal.tsxindex d0f4483ab4..ecfbef2564 100644--- a/packages/base-sheets/src/View/UI/Common/CellRange/CellRangeModal.tsx+++ b/packages/base-sheets/src/View/UI/Common/CellRange/CellRangeModal.tsx@@ -1,22 +1,29 @@-import { BaseComponentRender, BaseComponentSheet, Component, createRef, ModalButtonGroup } from '@univer/base-component';+import { BaseComponentRender, BaseComponentSheet, Component, createRef } from '@univer/base-component';+import { PLUGIN_NAMES } from '@univer/core';-interface CellRangeModalProps {+interface childrenProps {placeholder?: string;+}++export interface CellRangeModalProps {value?: string;title?: string;confirmText?: string;onClick?: () => void;+ group?: any[];+ children?: childrenProps;+ show?: boolean;}+interface IProps {}+interface CellRangeModalState {- show: boolean;+ modalData: CellRangeModalProps;}-export class CellRangeModal extends Component<CellRangeModalProps, CellRangeModalState> {+export class CellRangeModal extends Component<IProps, CellRangeModalState> {private _render: BaseComponentRender;- private _group: ModalButtonGroup[];-inputRef = createRef<HTMLInputElement>();modalRef = createRef();@@ -25,40 +32,33 @@ export class CellRangeModal extends Component<CellRangeModalProps, CellRangeModaconst component = this._context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;this._render = component.getComponentRender();- this._group = [- {- label: this.props.confirmText,- type: 'primary',- onClick: this.confirmRange,- },- ];-this.state = {- show: false,+ modalData: {},};}- componentDidMount() {}-- showModal(show: boolean) {- this.setState({- show,- });+ componentDidMount() {+ this._context.getObserverManager().getObserver<CellRangeModal>('onCellRangeModalDidMountObservable', PLUGIN_NAMES.SPREADSHEET)?.notifyObservers(this);}confirmRange() {const value = this.inputRef.current?.value;}+ setModal(modalData: CellRangeModalProps) {+ this.setState({+ modalData,+ });+ }+render() {- const { value, title, placeholder } = this.props;- const { show } = this.state;+ const { value, title, children, group, show } = this.state.modalData;const Input = this._render.renderFunction('Input');const Modal = this._render.renderFunction('Modal');-+ if (!show) return;return (- <Modal title={title} visible={show} group={this._group} ref={this.modalRef} mask={false}>- <Input ref={this.inputRef} readonly={true} placeholder={placeholder} value={value}></Input>+ <Modal isDrag={true} visible={show} title={title} group={group} mask={false}>+ <Input ref={this.inputRef} readonly={true} placeholder={children?.placeholder} value={value}></Input></Modal>);}diff --git a/packages/base-sheets/src/View/UI/Common/CellRange/index.module.css b/packages/base-sheets/src/View/UI/Common/CellRange/index.module.cssnew file mode 100644index 0000000000..f223e4c09f--- /dev/null+++ b/packages/base-sheets/src/View/UI/Common/CellRange/index.module.css@@ -0,0 +1,15 @@+.cell-range {+ position: relative;+ height: 100%;+}+.cell-range .cell-modal-icon {+ position: absolute;+ right: 0.5em;+ top: 50%;+ transform: translateY(-50%);+ height: 100%;+ color: var(--primary-color);+ cursor: pointer;+ display: flex;+ align-items: center;+}diff --git a/packages/base-sheets/src/View/UI/Common/CellRange/index.module.less b/packages/base-sheets/src/View/UI/Common/CellRange/index.module.lessindex 98649dbf2c..6d650022f9 100644--- a/packages/base-sheets/src/View/UI/Common/CellRange/index.module.less+++ b/packages/base-sheets/src/View/UI/Common/CellRange/index.module.less@@ -1,11 +1,7 @@-.cell-range-modal {+.cell-range {position: relative;height: 100%;- .input {- height: 100%;- }-.cell-modal-icon {position: absolute;right: 0.5em;diff --git a/packages/base-sheets/src/View/UI/Common/index.ts b/packages/base-sheets/src/View/UI/Common/index.tsindex 9e97ae8bd7..d37bcd88ef 100644--- a/packages/base-sheets/src/View/UI/Common/index.ts+++ b/packages/base-sheets/src/View/UI/Common/index.ts@@ -1,3 +1,4 @@// Basic business componentsexport * from './CellRange/CellRange';+export * from './CellRange/CellRangeModal';export * from './Select/Select';diff --git a/packages/base-sheets/src/View/UI/ModalGroup/ModalGroup.tsx b/packages/base-sheets/src/View/UI/ModalGroup/ModalGroup.tsxindex 526381f865..351be05247 100644--- a/packages/base-sheets/src/View/UI/ModalGroup/ModalGroup.tsx+++ b/packages/base-sheets/src/View/UI/ModalGroup/ModalGroup.tsx@@ -8,6 +8,8 @@ interface IState {}export class ModalGroup extends Component<any, IState> {+ refs: any[] = [];+initialize() {this.state = {modalGroup: [],@@ -21,10 +23,10 @@ export class ModalGroup extends Component<any, IState> {setModalGroup(group: ModalGroupProps) {const plugin = this._context.getPluginManager().getPluginByName<SheetPlugin>(PLUGIN_NAMES.SPREADSHEET);- const modalGroup = group.map((item) => {+ const modalGroup = group.map((item, index) => {const Modal = plugin?.getRegisterComponent(item);if (Modal) {- return <Modal />;+ return <Modal ref={(ele: any) => (this.refs[index] = ele)} />;}return null;});@@ -34,6 +36,10 @@ export class ModalGroup extends Component<any, IState> {});}+ getModalGroup() {+ return this.refs;+ }+render() {const { modalGroup } = this.state;return <>{modalGroup.map((item) => item)}</>;diff --git a/packages/base-sheets/src/View/UI/SheetContainer/SheetContainer.tsx b/packages/base-sheets/src/View/UI/SheetContainer/SheetContainer.tsxindex fb0d31e014..564f2e6304 100644--- a/packages/base-sheets/src/View/UI/SheetContainer/SheetContainer.tsx+++ b/packages/base-sheets/src/View/UI/SheetContainer/SheetContainer.tsx@@ -15,16 +15,7 @@ import {} from '@univer/base-component';import { AsyncFunction, SheetContext, IKeyType, LocaleType, PLUGIN_NAMES, Tools, Workbook } from '@univer/core';import cssVars from 'css-vars-ponyfill';-import {- Container,- Content,- Footer,- Header,- // InfoBar,- Layout,- // SheetBar,- Sider,-} from '@univer/style-universheet';+import { Container, Content, Footer, Header, Layout, Sider } from '@univer/style-universheet';import defaultSkin from '@univer/style-universheet/assets/css/skin/default.module.less';import darkSkin from '@univer/style-universheet/assets/css/skin/dark.module.less';// All skins' less file@@ -638,7 +629,7 @@ export class SheetContainer extends Component<BaseSheetContainerProps, IState> {* @returns {void}*/render() {- const { addButton, context } = this.props.config;+ const { context } = this.props.config;const { layout, currentLocale, currentSkin, siderPanelList, mainList, showSider, renderState } = this.state;// Set Provider for entire Container@@ -666,51 +657,9 @@ export class SheetContainer extends Component<BaseSheetContainerProps, IState> {}}>{/* innerLeft */}- {/* <FilterSelect />- <FilterSelect />- <FilterSelect /> */}- {/* <button- onClick={(e) => {- e.preventDefault();- const rect = this.btnRef.current && this.btnRef.current.getBoundingClientRect();-- this.cellRightRef.current && (this.cellRightRef.current as unknown as RightMenu).handleContextMenu(e, rect, true);- }}- ref={this.btnRef}- >- 点击- </button>- {/* <PrintMode- visible={this.state.printVisible}- onCancel={() => {- this.setState({- printVisible: !this.state.printVisible,- });- }}- /> */}</Sider><Content className={layout.contentSplit === 'vertical' ? style.contentContainerVertical : style.contentContainerHorizontal}>{/* extend main content */}- {/* {mainList.map((item: IMainState, i) => {- // if (!item.show) return null;-- if (item.type === ISlotElement.JSX) {- // return item.content;- return cloneElement(item.content as JSX.Element, {- style: { display: item.show ? '' : 'none' },- });- }- if (item.type === ISlotElement.JSX_STRING) {- // if (item.content === 'RichText') {- // const RichText = this.Render.renderFunction('RichText');- // return <RichText />;- // }- const JSXElement = this.Render.renderFunction(item.content as keyof Description);- this.refMap[item.name] = createRef<HTMLDivElement>();- return <JSXElement ref={this.refMap[item.name]} style={{ display: item.show ? '' : 'none' }} />;- }- return item;- })} */}<ModalGroup></ModalGroup>diff --git a/packages/sheets-plugin-formula/src/Controller/FormulaController.ts b/packages/sheets-plugin-formula/src/Controller/FormulaController.tsindex 87695d3f96..51851eb972 100644--- a/packages/sheets-plugin-formula/src/Controller/FormulaController.ts+++ b/packages/sheets-plugin-formula/src/Controller/FormulaController.ts@@ -64,7 +64,7 @@ export class FormulaController {},{locale: 'formula.formula.more',- onClick: () => this._plugin.getSearchFormulaController().showModal('SearchFormula', true),+ onClick: () => this._plugin.getSearchFormulaController().showFormulaModal('SearchFormula', true),},],});diff --git a/packages/sheets-plugin-formula/src/Controller/SearchFormulaModalController.ts b/packages/sheets-plugin-formula/src/Controller/SearchFormulaModalController.tsindex 5822fa7474..dd2195d6c6 100644--- a/packages/sheets-plugin-formula/src/Controller/SearchFormulaModalController.ts+++ b/packages/sheets-plugin-formula/src/Controller/SearchFormulaModalController.ts@@ -1,5 +1,5 @@import { ComponentChildren } from '@univer/base-component';-import { SheetPlugin } from '@univer/base-sheets';+import { SheetPlugin, CellRangeModal } from '@univer/base-sheets';import { PLUGIN_NAMES } from '@univer/core';import { FORMULA_PLUGIN_NAME, FunctionList, FunList, SelectCategoryType } from '../Basic';import { FormulaPlugin } from '../FormulaPlugin';@@ -30,7 +30,7 @@ export interface FunParams {}interface CustomComponent {- name: string;+ name?: string;props: {input?: ILabel;select?: ILabel;@@ -39,6 +39,9 @@ interface CustomComponent {calcLocale?: string;range?: string;onTableClick?: () => void;+ placeholderLocale?: string;+ titleLocale?: string;+ confirmTextLocale?: string;};}@@ -48,6 +51,7 @@ export interface SearchFormulaModalData {show?: boolean;mask?: boolean;group: ILabel[];+ titleLocale?: string;onCancel?: () => void;children: CustomComponent;modal?: ComponentChildren; // 渲染的组件@@ -64,6 +68,8 @@ export class SearchFormulaController {private _funParams: FunParams;+ private _cellRangeModalData: SearchFormulaModalData;+constructor(plugin: FormulaPlugin) {this._plugin = plugin;@@ -85,7 +91,7 @@ export class SearchFormulaController {locale: 'button.cancel',},],- onCancel: () => this.showModal('SearchFormula', false),+ onCancel: () => this.showFormulaModal('SearchFormula', false),children: {name: FORMULA_PLUGIN_NAME + SearchFormulaContent.name,props: {@@ -119,19 +125,38 @@ export class SearchFormulaController {locale: 'button.cancel',},],- onCancel: () => this.showModal('SearchItem', false),+ onCancel: () => this.showFormulaModal('SearchItem', false),children: {name: FORMULA_PLUGIN_NAME + SearchItem.name,props: {funParams: this._funParams,calcLocale: 'formula.formulaMore.calculationResult',range: 'A1:B10',- onTableClick: () => this.showModal('SearchItem', false),+ onTableClick: () => this.showCellRangeModal(true),},},},];+ this._cellRangeModalData = {+ name: 'cellRangeModal',+ titleLocale: 'formula.formulaMore.tipSelectDataRange',+ show: false,+ mask: false,+ group: [+ {+ locale: 'button.confirm',+ type: 'primary',+ },+ ],+ onCancel: () => this.showFormulaModal('cellRangeModal', false),+ children: {+ props: {+ placeholderLocale: '',+ },+ },+ };+this._initRegisterComponent();this._init();@@ -140,6 +165,9 @@ export class SearchFormulaController {private _init() {this._plugin.getObserver('onSearchFormulaModalDidMountObservable')!.add((component) => {this._formulaModal = component;++ this._modalData = this._resetLabel(this._modalData);+ this._cellRangeModalData = this._resetLabel(this._cellRangeModalData);});this._plugin.getObserver('onSearchItemDidMountObservable')!.add((component) => {@@ -218,35 +246,37 @@ export class SearchFormulaController {return list;}if (list instanceof Object) {- for (let k in list) {- list[k] = this._findLocale(list[k]);- }+ list = this._findLocale(list);+ // for (let k in list) {+ // list[k] = this._findLocale(list[k]);+ // }return list;}}- // 渲染所需数据- private _resetModalData() {- this._modalData = this._resetLabel(this._modalData);-- this._formulaModal.setModal(this._modalData);- }-selectFunParams(value: FunctionList) {this._funParams.funParams = value;}- showModal(name: string, show: boolean) {+ showFormulaModal(name: string, show: boolean) {const index = this._modalData.findIndex((item) => item.name === name);if (index > -1) {this._modalData[index].show = show;- this._resetModalData();+ this._formulaModal.setModal(this._modalData);}}+ showCellRangeModal(show: boolean) {+ this._cellRangeModalData.show = show;+ const sheetPlugin = this._plugin.getPluginByName<SheetPlugin>(PLUGIN_NAMES.SPREADSHEET);+ const cellRangeModal = sheetPlugin?.getModalGroupControl().getModal(CellRangeModal.name);+ cellRangeModal.setModal(this._cellRangeModalData);+ this.showFormulaModal('SearchItem', false);+ }+showSearchItemModal() {- this.showModal('SearchFormula', false);- this.showModal('SearchItem', true);+ this.showFormulaModal('SearchFormula', false);+ this.showFormulaModal('SearchItem', true);}}diff --git a/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchFormulaModal.tsx b/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchFormulaModal.tsxindex f6f0c0ea75..bfd6dcdb4f 100644--- a/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchFormulaModal.tsx+++ b/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchFormulaModal.tsx@@ -32,7 +32,7 @@ export class SearchFormulaModal extends Component<IProps, IState> {const SheetPlugin = this._context.getPluginManager().getPluginByName<SheetPlugin>(PLUGIN_NAMES.SPREADSHEET)!;modalData.forEach((item) => {- const Label = SheetPlugin.getRegisterComponent(item.children.name);+ const Label = SheetPlugin.getRegisterComponent(item.children.name!);if (Label) {const props = item.children.props ?? {};item.modal = <Label {...props} />;diff --git a/packages/style-universheet/src/Components/Input/Style/mixin.css b/packages/style-universheet/src/Components/Input/Style/mixin.cssnew file mode 100644index 0000000000..4ed4a7474e--- /dev/null+++ b/packages/style-universheet/src/Components/Input/Style/mixin.css@@ -0,0 +1,5 @@+/*+1. 所有的变量加到这里,复用+2. 组件要用的话,在这定义好,导入组件使用+3. 需要作为皮肤变量的,导入到所有皮肤中导出使用+*/diff --git a/packages/style-universheet/src/Components/Input/Style/mixin.less b/packages/style-universheet/src/Components/Input/Style/mixin.lessindex 07294c85d9..9c01a4d0c9 100644--- a/packages/style-universheet/src/Components/Input/Style/mixin.less+++ b/packages/style-universheet/src/Components/Input/Style/mixin.less@@ -1,14 +1,14 @@@import '../../../assets/css/skin/base.module.less';.active() {- border-right-width: @border-width-base !important;+ border-right-width: @border-width-base !important;outline: 0;box-shadow: var(--box-shadow-base);}.hover(@color: var(--primary-color-hover)) {border-color: @color;- border-right-width: @border-width-base !important;+ border-right-width: @border-width-base !important;}.disabled() {@@ -29,6 +29,7 @@display: inline-block;width: 100%;min-width: 0;+ box-sizing: border-box;padding: 2px 7px;color: var(--text-color);font-size: @font-size-base;@@ -71,4 +72,4 @@.active();}}-}+}\ No newline at end of filediff --git a/packages/style-universheet/src/Components/Modal/Modal.tsx b/packages/style-universheet/src/Components/Modal/Modal.tsxindex 05eb352eee..de9688c1d3 100644--- a/packages/style-universheet/src/Components/Modal/Modal.tsx+++ b/packages/style-universheet/src/Components/Modal/Modal.tsx@@ -27,6 +27,14 @@ class Modal extends Component<BaseModalProps, IState> {}));};+ componentWillReceiveProps(props: BaseModalProps) {+ if (props.visible !== this.state.visible) {+ this.setState({+ visible: props.visible,+ });+ }+ }+// maskClick = (e: MouseEvent) => {// const mask = document.querySelector(`.${styles.modalMask}`);// if (e.target === mask) {@@ -35,7 +43,7 @@ class Modal extends Component<BaseModalProps, IState> {// }// };handleClick = (cb?: () => void) => {- // this.showModal(false);+ this.showModal(false);if (cb) cb();};