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(plugin): eslint error
tonytonychopper123c7b81003f221
diff --git a/packages/base-docs/src/Model/ToolbarModel.ts b/packages/base-docs/src/Model/ToolbarModel.tsindex b2a0891a64..016858899e 100644--- a/packages/base-docs/src/Model/ToolbarModel.ts+++ b/packages/base-docs/src/Model/ToolbarModel.ts@@ -1,91 +1,91 @@-import { BaseSelectChildrenProps, BaseSelectProps } from '../View/UI/Common/Select/Select';-import { BaseTextButtonProps } from '../View/UI/Common/TextButton/TextButton';+// import { BaseSelectChildrenProps, BaseSelectProps } from '../View/UI/Common/Select/Select';+// import { BaseTextButtonProps } from '../View/UI/Common/TextButton/TextButton';-export interface IShowToolbarConfig {- undoRedo?: boolean; // Undo redo- paintFormat?: boolean; // Format brush- currencyFormat?: boolean; // currency format- percentageFormat?: boolean; // Percentage format- numberDecrease?: boolean; // 'Decrease the number of decimal places'- numberIncrease?: boolean; // 'Increase the number of decimal places- moreFormats?: boolean; // 'More Formats'- font?: boolean; // 'font'- fontSize?: boolean; // 'Font size'- bold?: boolean; // 'Bold (Ctrl+B)'- italic?: boolean; // 'Italic (Ctrl+I)'- strikethrough?: boolean; // 'Strikethrough (Alt+Shift+5)'- underline?: boolean; // 'Underline (Alt+Shift+6)'- textColor?: boolean; // 'Text color'- fillColor?: boolean; // 'Cell color'- border?: boolean; // 'border'- mergeCell?: boolean; // 'Merge cells'- horizontalAlignMode?: boolean; // 'Horizontal alignment'- verticalAlignMode?: boolean; // 'Vertical alignment'- textWrapMode?: boolean; // 'Wrap mode'- textRotateMode?: boolean; // 'Text Rotation Mode'+// export interface IShowToolbarConfig {+// undoRedo?: boolean; // Undo redo+// paintFormat?: boolean; // Format brush+// currencyFormat?: boolean; // currency format+// percentageFormat?: boolean; // Percentage format+// numberDecrease?: boolean; // 'Decrease the number of decimal places'+// numberIncrease?: boolean; // 'Increase the number of decimal places+// moreFormats?: boolean; // 'More Formats'+// font?: boolean; // 'font'+// fontSize?: boolean; // 'Font size'+// bold?: boolean; // 'Bold (Ctrl+B)'+// italic?: boolean; // 'Italic (Ctrl+I)'+// strikethrough?: boolean; // 'Strikethrough (Alt+Shift+5)'+// underline?: boolean; // 'Underline (Alt+Shift+6)'+// textColor?: boolean; // 'Text color'+// fillColor?: boolean; // 'Cell color'+// border?: boolean; // 'border'+// mergeCell?: boolean; // 'Merge cells'+// horizontalAlignMode?: boolean; // 'Horizontal alignment'+// verticalAlignMode?: boolean; // 'Vertical alignment'+// textWrapMode?: boolean; // 'Wrap mode'+// textRotateMode?: boolean; // 'Text Rotation Mode'- image?: boolean; // 'Insert picture'- link?: boolean; // 'Insert link'- chart?: boolean; // 'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click)- comment?: boolean; // 'comment'- pivotTable?: boolean; // 'PivotTable'- function?: boolean; // 'formula'- frozenMode?: boolean; // 'freeze mode'- sortAndFilter?: boolean; // 'Sort and filter'- conditionalFormat?: boolean; // 'Conditional Format'- dataValidation?: boolean; // 'Data Validation'- splitColumn?: boolean; // 'Split column'- screenshot?: boolean; // 'screenshot'- findAndReplace?: boolean; // 'Find and Replace'- protection?: boolean; // 'Worksheet protection'- print?: boolean; // 'Print'-}+// image?: boolean; // 'Insert picture'+// link?: boolean; // 'Insert link'+// chart?: boolean; // 'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click)+// comment?: boolean; // 'comment'+// pivotTable?: boolean; // 'PivotTable'+// function?: boolean; // 'formula'+// frozenMode?: boolean; // 'freeze mode'+// sortAndFilter?: boolean; // 'Sort and filter'+// conditionalFormat?: boolean; // 'Conditional Format'+// dataValidation?: boolean; // 'Data Validation'+// splitColumn?: boolean; // 'Split column'+// screenshot?: boolean; // 'screenshot'+// findAndReplace?: boolean; // 'Find and Replace'+// protection?: boolean; // 'Worksheet protection'+// print?: boolean; // 'Print'+// }-enum ToolbarType {- SELECT,- BUTTON,-}+// enum ToolbarType {+// SELECT,+// BUTTON,+// }-// 继承基础下拉属性,添加国际化-export interface BaseToolbarSelectChildrenProps extends BaseSelectChildrenProps {- locale?: string;- suffixLocale?: string;- children?: BaseToolbarSelectChildrenProps[];-}+// // 继承基础下拉属性,添加国际化+// export interface BaseToolbarSelectChildrenProps extends BaseSelectChildrenProps {+// locale?: string;+// suffixLocale?: string;+// children?: BaseToolbarSelectChildrenProps[];+// }-interface BaseToolbarSelectProps extends BaseSelectProps {- locale?: string;- suffixLocale?: string;- children?: BaseToolbarSelectChildrenProps[];-}+// interface BaseToolbarSelectProps extends BaseSelectProps {+// locale?: string;+// suffixLocale?: string;+// children?: BaseToolbarSelectChildrenProps[];+// }-export interface IToolbarItemProps extends BaseToolbarSelectProps, BaseTextButtonProps {- show?: boolean; //是否显示按钮- toolbarType?: ToolbarType;- locale?: string; //label国际化- tooltipLocale?: string; //tooltip国际化- tooltip?: string; //tooltip文字- border?: boolean;-}+// export interface IToolbarItemProps extends BaseToolbarSelectProps, BaseTextButtonProps {+// show?: boolean; //是否显示按钮+// toolbarType?: ToolbarType;+// locale?: string; //label国际化+// tooltipLocale?: string; //tooltip国际化+// tooltip?: string; //tooltip文字+// border?: boolean;+// }-export class ToolbarModel {- private _config: IShowToolbarConfig[];+// export class ToolbarModel {+// private _config: IShowToolbarConfig[];- private _toolList: IToolbarItemProps[];+// private _toolList: IToolbarItemProps[];- get config(): IShowToolbarConfig[] {- return this._config;- }+// get config(): IShowToolbarConfig[] {+// return this._config;+// }- get toolList(): IToolbarItemProps[] {- return this._toolList;- }+// get toolList(): IToolbarItemProps[] {+// return this._toolList;+// }- set config(value: IShowToolbarConfig[]) {- this._config = value;- }+// set config(value: IShowToolbarConfig[]) {+// this._config = value;+// }- set toolList(value: IToolbarItemProps[]) {- this._toolList = value;- }-}+// set toolList(value: IToolbarItemProps[]) {+// this._toolList = value;+// }+// }diff --git a/packages/base-slides/src/Basics/Observer.ts b/packages/base-slides/src/Basics/Observer.tsindex 44ef04e6ca..e18b268548 100644--- a/packages/base-slides/src/Basics/Observer.ts+++ b/packages/base-slides/src/Basics/Observer.ts@@ -1,8 +1,8 @@import { IKeyboardEvent } from '@univerjs/base-render';import { Observable, Plugin } from '@univerjs/core';-import { SlideBar } from '@univerjs/ui-plugin-slides/src/View/SlideBar/SlideBar';-import { SlideContainer } from '../View/UI/SlideContainer';-import { Toolbar } from '../View/UI/ToolBar/Toolbar';+// import { SlideBar } from '@univerjs/ui-plugin-slides/src/View/SlideBar/SlideBar';+// import { SlideContainer } from '../View/UI/SlideContainer';+// import { Toolbar } from '../View/UI/ToolBar/Toolbar';export type SlidePluginObserve = {onAfterChangeFontFamilyObservable: Observable<string>;@@ -16,10 +16,10 @@ export type SlidePluginObserve = {onChangeCurrentSheetObserver: Observable<string>;- onToolbarDidMountObservable: Observable<Toolbar>;- onSlideBarDidMountObservable: Observable<SlideBar>;+ // onToolbarDidMountObservable: Observable<Toolbar>;+ // onSlideBarDidMountObservable: Observable<SlideBar>;- onSlideContainerDidMountObservable: Observable<SlideContainer>;+ // onSlideContainerDidMountObservable: Observable<SlideContainer>;onSpreadsheetKeyDownObservable: Observable<IKeyboardEvent>;onSpreadsheetKeyUpObservable: Observable<IKeyboardEvent>;diff --git a/packages/base-slides/src/Controller/InfoBarController.ts b/packages/base-slides/src/Controller/InfoBarController.tsindex 82c0b5877e..e3d7f68f3f 100644--- a/packages/base-slides/src/Controller/InfoBarController.ts+++ b/packages/base-slides/src/Controller/InfoBarController.ts@@ -1,7 +1,6 @@-import { PLUGIN_NAMES } from '@univerjs/core';+// import { InfoBar } from '@univerjs/ui-plugin-slides/src/View/InfoBar/InfoBar';import { InfoBarModel } from '../Model/InfoBarModel';import { SlidePlugin } from '../SlidePlugin';-import { InfoBar } from '../View/UI/InfoBar';type IProps = {locale?: string;@@ -20,7 +19,7 @@ export interface BaseInfoBarProps {export class InfoBarController {private _infoBarModel: InfoBarModel;- private _infoBar: InfoBar;+ // private _infoBar: InfoBar;private _plugin: SlidePlugin;@@ -56,24 +55,14 @@ export class InfoBarController {this._initialize();}- private _initialize() {- const context = this._plugin.context;- const manager = context.getObserverManager();-- manager.requiredObserver<InfoBar>('onInfoBarDidMountObservable', PLUGIN_NAMES.SLIDE).add((component) => {- this._infoBar = component;- this.resetInfoList(this._infoList);- });- }-resetInfoList(list: BaseInfoBarProps) {- const locale = this._plugin.context.getLocale();- for (let k in list) {- if (list[k].locale) {- list[k].label = locale.get(list[k].locale);- }- }- this._infoBar.setInfoList(list);+ // const locale = this._plugin.context.getLocale();+ // for (let k in list) {+ // if (list[k].locale) {+ // list[k].label = locale.get(list[k].locale);+ // }+ // }+ // this._infoBar.setInfoList(list);}setSlideName(e: FocusEvent) {@@ -81,4 +70,14 @@ export class InfoBarController {const name = target.value;this._infoBarModel.setName(name);}++ private _initialize() {+ const context = this._plugin.context;+ const manager = context.getObserverManager();++ // manager.requiredObserver<InfoBar>('onInfoBarDidMountObservable', PLUGIN_NAMES.SLIDE).add((component) => {+ // this._infoBar = component;+ // this.resetInfoList(this._infoList);+ // });+ }}diff --git a/packages/base-slides/src/Model/ToolbarModel.ts b/packages/base-slides/src/Model/ToolbarModel.tsindex b2a0891a64..016858899e 100644--- a/packages/base-slides/src/Model/ToolbarModel.ts+++ b/packages/base-slides/src/Model/ToolbarModel.ts@@ -1,91 +1,91 @@-import { BaseSelectChildrenProps, BaseSelectProps } from '../View/UI/Common/Select/Select';-import { BaseTextButtonProps } from '../View/UI/Common/TextButton/TextButton';+// import { BaseSelectChildrenProps, BaseSelectProps } from '../View/UI/Common/Select/Select';+// import { BaseTextButtonProps } from '../View/UI/Common/TextButton/TextButton';-export interface IShowToolbarConfig {- undoRedo?: boolean; // Undo redo- paintFormat?: boolean; // Format brush- currencyFormat?: boolean; // currency format- percentageFormat?: boolean; // Percentage format- numberDecrease?: boolean; // 'Decrease the number of decimal places'- numberIncrease?: boolean; // 'Increase the number of decimal places- moreFormats?: boolean; // 'More Formats'- font?: boolean; // 'font'- fontSize?: boolean; // 'Font size'- bold?: boolean; // 'Bold (Ctrl+B)'- italic?: boolean; // 'Italic (Ctrl+I)'- strikethrough?: boolean; // 'Strikethrough (Alt+Shift+5)'- underline?: boolean; // 'Underline (Alt+Shift+6)'- textColor?: boolean; // 'Text color'- fillColor?: boolean; // 'Cell color'- border?: boolean; // 'border'- mergeCell?: boolean; // 'Merge cells'- horizontalAlignMode?: boolean; // 'Horizontal alignment'- verticalAlignMode?: boolean; // 'Vertical alignment'- textWrapMode?: boolean; // 'Wrap mode'- textRotateMode?: boolean; // 'Text Rotation Mode'+// export interface IShowToolbarConfig {+// undoRedo?: boolean; // Undo redo+// paintFormat?: boolean; // Format brush+// currencyFormat?: boolean; // currency format+// percentageFormat?: boolean; // Percentage format+// numberDecrease?: boolean; // 'Decrease the number of decimal places'+// numberIncrease?: boolean; // 'Increase the number of decimal places+// moreFormats?: boolean; // 'More Formats'+// font?: boolean; // 'font'+// fontSize?: boolean; // 'Font size'+// bold?: boolean; // 'Bold (Ctrl+B)'+// italic?: boolean; // 'Italic (Ctrl+I)'+// strikethrough?: boolean; // 'Strikethrough (Alt+Shift+5)'+// underline?: boolean; // 'Underline (Alt+Shift+6)'+// textColor?: boolean; // 'Text color'+// fillColor?: boolean; // 'Cell color'+// border?: boolean; // 'border'+// mergeCell?: boolean; // 'Merge cells'+// horizontalAlignMode?: boolean; // 'Horizontal alignment'+// verticalAlignMode?: boolean; // 'Vertical alignment'+// textWrapMode?: boolean; // 'Wrap mode'+// textRotateMode?: boolean; // 'Text Rotation Mode'- image?: boolean; // 'Insert picture'- link?: boolean; // 'Insert link'- chart?: boolean; // 'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click)- comment?: boolean; // 'comment'- pivotTable?: boolean; // 'PivotTable'- function?: boolean; // 'formula'- frozenMode?: boolean; // 'freeze mode'- sortAndFilter?: boolean; // 'Sort and filter'- conditionalFormat?: boolean; // 'Conditional Format'- dataValidation?: boolean; // 'Data Validation'- splitColumn?: boolean; // 'Split column'- screenshot?: boolean; // 'screenshot'- findAndReplace?: boolean; // 'Find and Replace'- protection?: boolean; // 'Worksheet protection'- print?: boolean; // 'Print'-}+// image?: boolean; // 'Insert picture'+// link?: boolean; // 'Insert link'+// chart?: boolean; // 'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click)+// comment?: boolean; // 'comment'+// pivotTable?: boolean; // 'PivotTable'+// function?: boolean; // 'formula'+// frozenMode?: boolean; // 'freeze mode'+// sortAndFilter?: boolean; // 'Sort and filter'+// conditionalFormat?: boolean; // 'Conditional Format'+// dataValidation?: boolean; // 'Data Validation'+// splitColumn?: boolean; // 'Split column'+// screenshot?: boolean; // 'screenshot'+// findAndReplace?: boolean; // 'Find and Replace'+// protection?: boolean; // 'Worksheet protection'+// print?: boolean; // 'Print'+// }-enum ToolbarType {- SELECT,- BUTTON,-}+// enum ToolbarType {+// SELECT,+// BUTTON,+// }-// 继承基础下拉属性,添加国际化-export interface BaseToolbarSelectChildrenProps extends BaseSelectChildrenProps {- locale?: string;- suffixLocale?: string;- children?: BaseToolbarSelectChildrenProps[];-}+// // 继承基础下拉属性,添加国际化+// export interface BaseToolbarSelectChildrenProps extends BaseSelectChildrenProps {+// locale?: string;+// suffixLocale?: string;+// children?: BaseToolbarSelectChildrenProps[];+// }-interface BaseToolbarSelectProps extends BaseSelectProps {- locale?: string;- suffixLocale?: string;- children?: BaseToolbarSelectChildrenProps[];-}+// interface BaseToolbarSelectProps extends BaseSelectProps {+// locale?: string;+// suffixLocale?: string;+// children?: BaseToolbarSelectChildrenProps[];+// }-export interface IToolbarItemProps extends BaseToolbarSelectProps, BaseTextButtonProps {- show?: boolean; //是否显示按钮- toolbarType?: ToolbarType;- locale?: string; //label国际化- tooltipLocale?: string; //tooltip国际化- tooltip?: string; //tooltip文字- border?: boolean;-}+// export interface IToolbarItemProps extends BaseToolbarSelectProps, BaseTextButtonProps {+// show?: boolean; //是否显示按钮+// toolbarType?: ToolbarType;+// locale?: string; //label国际化+// tooltipLocale?: string; //tooltip国际化+// tooltip?: string; //tooltip文字+// border?: boolean;+// }-export class ToolbarModel {- private _config: IShowToolbarConfig[];+// export class ToolbarModel {+// private _config: IShowToolbarConfig[];- private _toolList: IToolbarItemProps[];+// private _toolList: IToolbarItemProps[];- get config(): IShowToolbarConfig[] {- return this._config;- }+// get config(): IShowToolbarConfig[] {+// return this._config;+// }- get toolList(): IToolbarItemProps[] {- return this._toolList;- }+// get toolList(): IToolbarItemProps[] {+// return this._toolList;+// }- set config(value: IShowToolbarConfig[]) {- this._config = value;- }+// set config(value: IShowToolbarConfig[]) {+// this._config = value;+// }- set toolList(value: IToolbarItemProps[]) {- this._toolList = value;- }-}+// set toolList(value: IToolbarItemProps[]) {+// this._toolList = value;+// }+// }diff --git a/packages/base-slides/src/View/Render/Adaptors/ShapeAdaptor.ts b/packages/base-slides/src/View/Render/Adaptors/ShapeAdaptor.tsindex 442e8f5f1e..c2f522a7f9 100644--- a/packages/base-slides/src/View/Render/Adaptors/ShapeAdaptor.ts+++ b/packages/base-slides/src/View/Render/Adaptors/ShapeAdaptor.ts@@ -71,8 +71,8 @@ export class ShapeAdaptor extends ObjectAdaptor {...strokeStyle,});}- if (shapeType === ShapeType.ELLIPSE) {- }+ // if (shapeType === ShapeType.ELLIPSE) {+ // }}}diff --git a/packages/base-slides/src/View/Render/ObjectProvider.ts b/packages/base-slides/src/View/Render/ObjectProvider.tsindex 2688067c18..6a9f867800 100644--- a/packages/base-slides/src/View/Render/ObjectProvider.ts+++ b/packages/base-slides/src/View/Render/ObjectProvider.ts@@ -1,7 +1,7 @@import { BaseObject, Scene } from '@univerjs/base-render';import { ContextBase, IPageElement, sortRules } from '@univerjs/core';import { CanvasObjectProviderRegistry, ObjectAdaptor } from './Adaptor';-import './Adaptors';+// import './Adaptors';export class ObjectProvider {private _adaptors: ObjectAdaptor[] = [];@@ -10,6 +10,10 @@ export class ObjectProvider {this._adaptorLoader();}+ static create() {+ return new ObjectProvider();+ }+convertToRenderObjects(pageElements: { [elementId: string]: IPageElement }, mainScene: Scene, context: ContextBase) {const pageKeys = Object.keys(pageElements);const objects: BaseObject[] = [];@@ -41,8 +45,4 @@ export class ObjectProvider {this._adaptors.push(adaptor);});}-- static create() {- return new ObjectProvider();- }}diff --git a/packages/base-ui/src/BaseComponent.ts b/packages/base-ui/src/BaseComponent.tsindex 826b95261c..cadca67c74 100644--- a/packages/base-ui/src/BaseComponent.ts+++ b/packages/base-ui/src/BaseComponent.ts@@ -30,13 +30,13 @@ export interface BaseComponentRender {// Components interfaceconst ButtonTypes: string[] = ['default', 'primary'];-export type ButtonType = (typeof ButtonTypes)[number];+export type ButtonType = typeof ButtonTypes[number];const ButtonShapes: string[] = ['circle', 'round'];-export type ButtonShape = (typeof ButtonShapes)[number];+export type ButtonShape = typeof ButtonShapes[number];const SizeTypes: string[] = ['small', 'middle', 'large'];-export type SizeType = (typeof SizeTypes)[number];+export type SizeType = typeof SizeTypes[number];const ButtonHTMLTypes: string[] = ['submit', 'rest', 'button'];-export type ButtonHTMLType = (typeof ButtonHTMLTypes)[number];+export type ButtonHTMLType = typeof ButtonHTMLTypes[number];export interface BaseButtonProps extends BaseComponentProps {type?: ButtonType;diff --git a/packages/base-ui/src/Components/Dropdown/Dropdown.tsx b/packages/base-ui/src/Components/Dropdown/Dropdown.tsxindex 1e5ca026f6..02b08eaa6e 100644--- a/packages/base-ui/src/Components/Dropdown/Dropdown.tsx+++ b/packages/base-ui/src/Components/Dropdown/Dropdown.tsx@@ -1,6 +1,6 @@import { Icon } from '..';import { JSXComponent } from '../../BaseComponent';-import { PureComponent, createRef } from '../../Framework';+import { PureComponent, createRef } from '../../Framework';import { BaseDropdownProps, DropdownComponent } from '../../Interfaces';import { Menu } from '../Menu';import { Tooltip } from '../Tooltip';diff --git a/packages/sheets-plugin-conditional-format/src/ConditionalFormatRuleBuilder.ts b/packages/sheets-plugin-conditional-format/src/ConditionalFormatRuleBuilder.tsindex 932628d46e..5d88014369 100644--- a/packages/sheets-plugin-conditional-format/src/ConditionalFormatRuleBuilder.ts+++ b/packages/sheets-plugin-conditional-format/src/ConditionalFormatRuleBuilder.ts@@ -1,698 +1,698 @@-import { ConditionType, InterpolationPointType, Range, IRangeData, IStyleData, Nullable, RelativeDate } from '@univerjs/core';-import { ConditionalFormatRule } from './ConditionalFormatRule';-import { BooleanCondition, BooleanRule, ConditionValue, GradientRule, InterpolationPoint } from './IData/IConditionalFormatRule';--export class ConditionalFormatRuleBuilder {- private _ranges: IRangeData[];-- private _booleanRule: BooleanRule;-- private _gradientRule: GradientRule;-- private _format: IStyleData;-- private _condition: BooleanCondition;-- private _maxPoint: InterpolationPoint;-- private _minPoint: InterpolationPoint;-- private _midPoint: Nullable<InterpolationPoint>;-- /**- * get condition of date format- */- private _getDate = (type: ConditionType, date: RelativeDate | Date) => {- let value: ConditionValue;- if (typeof date === 'object') {- value = {- userEnteredValue: (+date).toString(),- };- } else {- value = {- relativeDate: date,- };- }- this._condition = {- type,- values: [value],- };- };-- private _setBooleanRule() {- this._booleanRule = {- condition: this._condition,- format: this._format,- };- }-- /**- * get condition of text format- */- private _getText(type: ConditionType, value: string) {- this._condition = {- type,- values: [- {- userEnteredValue: value,- },- ],- };- }-- /**- * get condition of number format- */- private _getNumber(type: ConditionType, value: number[]) {- const values: ConditionValue[] = [];- for (let i = 0; i < value.length; i++) {- values.push({- userEnteredValue: value[i].toString(),- });- }- this._condition = {- type,- values,- };- }-- constructor(ranges?: IRangeData[], rule?: BooleanRule | GradientRule) {- this._ranges = ranges ?? [];- if (rule) {- if ('condition' in rule) {- this._booleanRule = rule;- } else {- this._gradientRule = rule;- }- }- }-- /**- * Constructs a conditional format rule from the settings applied to the builder.- */- build(): ConditionalFormatRule {- return new ConditionalFormatRule(this._ranges, this._booleanRule ?? this._gradientRule);- }-- /**- * Sets the background color for the conditional format rule's format. Passing in null removes the background color format setting from the rule.- */- setBackground(color: Nullable<string>): ConditionalFormatRuleBuilder {- const bgColor = {- rgb: color,- };- this._format.bg = bgColor;- this._setBooleanRule();-- return this;- }-- /**- *- * Sets text bolding for the conditional format rule's format. If bold is true, the rule bolds text if the condition is met; if false, the rule removes any existing bolding if the condition is met. Passing in null removes the bold format setting from the rule.- */- setBold(bold: Nullable<boolean>): ConditionalFormatRuleBuilder {- if (bold === null) {- delete this._format.bl;- } else if (bold) {- this._format.bl = 1;- } else {- this._format.bl = 0;- }- this._setBooleanRule();-- return this;- }-- /**- * Sets the font color for the conditional format rule's format. Passing in null removes the font color format setting from the rule.- */- setFontColor(color: Nullable<string>): ConditionalFormatRuleBuilder {- const fontColor = {- rgb: color,- };- this._format.cl = fontColor;- this._setBooleanRule();-- return this;- }-- /**- * Sets text italics for the conditional format rule's format. If italic is true, the rule italicises text if the condition is met; if false, the rule removes any existing italicization if the condition is met. Passing in null removes the italic format setting from the rule.- */- setItalic(italic: Nullable<boolean>): ConditionalFormatRuleBuilder {- if (italic === null) {- delete this._format.it;- } else if (italic) {- this._format.it = 1;- } else {- this._format.it = 0;- }- this._setBooleanRule();-- return this;- }-- /**- * Sets one or more ranges to which this conditional format rule is applied. This operation replaces any existing ranges. Setting an empty array clears any existing ranges. A rule must have at least one range.- */- setRanges(ranges: Range[]): ConditionalFormatRuleBuilder {- const range = [];- for (let i = 0; i < ranges.length; i++) {- range.push(ranges[i].getRangeData());- }- this._ranges = range;-- return this;- }-- /**- * Sets text strikethrough for the conditional format rule's format. If strikethrough is true, the rule strikesthrough text if the condition is met; if false, the rule removes any existing strikethrough formatting if the condition is met. Passing in null removes the strikethrough format setting from the rule.- */- setStrikethrough(strikethrough: Nullable<boolean>): ConditionalFormatRuleBuilder {- if (!this._format.st) {- this._format.st = { s: 1 };- }-- if (strikethrough === null) {- delete this._format.st;- } else if (strikethrough) {- this._format.st.s = 1;- } else {- this._format.st.s = 0;- }- this._setBooleanRule();-- return this;- }-- /**- * Sets text underlining for the conditional format rule's format. If underline is true, the rule underlines text if the condition is met; if false, the rule removes any existing underlines if the condition is met. Passing in null removes the underline format setting from the rule.- */- setUnderline(underline: Nullable<boolean>): ConditionalFormatRuleBuilder {- if (!this._format.ul) {- this._format.ul = { s: 1 };- }-- if (underline === null) {- delete this._format.st;- } else if (underline) {- this._format.ul.s = 1;- } else {- this._format.ul.s = 0;- }- this._setBooleanRule();-- return this;- }-- /**- * Sets the conditional format rule to trigger when the cell is empty.- */- whenCellEmpty(): ConditionalFormatRuleBuilder {- const type = ConditionType.BLANK;- this._condition = {- type,- };-- return this;- }-- /**- * Sets the conditional format rule to trigger when the cell is not empty.- */- whenCellNotEmpty(): ConditionalFormatRuleBuilder {- const type = ConditionType.NOT_BLANK;- this._condition = {- type,- };-- return this;- }-- /**- * Sets the conditional format rule to trigger when a date is after the given value.- */- whenDateAfter(date: RelativeDate | Date): ConditionalFormatRuleBuilder {- this._getDate(ConditionType.DATE_AFTER, date);- return this;- }-- /**- * Sets the conditional format rule to trigger when a date is before the given date.- */- whenDateBefore(date: RelativeDate | Date): ConditionalFormatRuleBuilder {- this._getDate(ConditionType.DATE_BEFORE, date);- return this;- }-- /**- * Sets the conditional format rule to trigger when a date is equal to the given relative date.- */- whenDateEqualTo(date: RelativeDate | Date): ConditionalFormatRuleBuilder {- this._getDate(ConditionType.DATE_EQ, date);- return this;- }-- /**- * Sets the conditional format rule to trigger when a number falls between, or is either of, two specified values.- */- whenNumberBetween(start: number, end: number): ConditionalFormatRuleBuilder {- let value: number[];- if (start === end) {- value = [start];- } else if (start > end) {- value = [end, start];- } else {- value = [start, end];- }-- this._getNumber(ConditionType.NUMBER_BETWEEN, value);- return this;- }-- /**- * Sets the conditional format rule to trigger when a number is equal to the given value.- */- whenNumberEqualTo(number: number): ConditionalFormatRuleBuilder {- this._getNumber(ConditionType.NUMBER_EQ, [number]);- return this;- }-- /**- * Sets the conditional format rule to trigger when a number is greater than the given value.- */- whenNumberGreaterThan(number: number): ConditionalFormatRuleBuilder {- this._getNumber(ConditionType.NUMNUMBER_BETWEENR_GREATER, [number]);- return this;- }-- /**- * Sets the conditional format rule to trigger when a number is greater than or equal to the given value.- */- whenNumberGreaterThanOrEqualTo(number: number): ConditionalFormatRuleBuilder {- this._getNumber(ConditionType.NUMBER_GREATER_THAN_EQ, [number]);- return this;- }-- /**- * Sets the conditional conditional format rule to trigger when a number less than the given value.- */- whenNumberLessThan(number: number): ConditionalFormatRuleBuilder {- this._getNumber(ConditionType.NUMBER_LESS, [number]);- return this;- }-- /**- * Sets the conditional format rule to trigger when a number less than or equal to the given value.- */- whenNumberLessThanOrEqualTo(number: number): ConditionalFormatRuleBuilder {- this._getNumber(ConditionType.NUMBER_LESS_THAN_EQ, [number]);- return this;- }-- /**- * Sets the conditional format rule to trigger when a number does not fall between, and is neither of, two specified values.- */- whenNumberNotBetween(start: number, end: number): ConditionalFormatRuleBuilder {- let value: number[];- if (start === end) {- value = [start];- } else if (start > end) {- value = [end, start];- } else {- value = [start, end];- }-- this._getNumber(ConditionType.NUMBER_NOT_BETWEEN, value);- return this;- }-- /**- * Sets the conditional format rule to trigger when a number is not equal to the given value.- */- whenNumberNotEqualTo(number: number): ConditionalFormatRuleBuilder {- this._getNumber(ConditionType.NUMBER_NOT_EQ, [number]);- return this;- }-- /**- * Sets the conditional format rule to trigger when that the given formula evaluates to true.- */- whenFormulaSatisfied(formula: string): ConditionalFormatRuleBuilder {- this._getText(ConditionType.CUSTOM_FORMULA, formula);- return this;- }-- /**- * Sets the conditional format rule to trigger when that the input contains the given value.- */- whenTextContains(text: string): ConditionalFormatRuleBuilder {- this._getText(ConditionType.TEXT_CONTAINS, text);- return this;- }-- /**- * Sets the conditional format rule to trigger when that the input does not contain the given value.- */- whenTextDoesNotContain(text: string): ConditionalFormatRuleBuilder {- this._getText(ConditionType.TEXT_NOT_CONTAINS, text);- return this;- }-- /**- * Sets the conditional format rule to trigger when that the input ends with the given value.- */- whenTextEndsWith(text: string): ConditionalFormatRuleBuilder {- this._getText(ConditionType.TEXT_ENDS_WITH, text);- return this;- }-- /**- * Sets the conditional format rule to trigger when that the input is equal to the given value.- */- whenTextEqualTo(text: string): ConditionalFormatRuleBuilder {- this._getText(ConditionType.TEXT_EQ, text);- return this;- }-- /**- * Sets the conditional format rule to trigger when that the input starts with the given value.- */- whenTextStartsWith(text: string): ConditionalFormatRuleBuilder {- this._getText(ConditionType.TEXT_STARTS_WITH, text);- return this;- }-- /**- * Sets the conditional format rule to criteria defined by BooleanCriteria values, typically taken from the criteria and arguments of an existing rule.- */- withCriteria(criteria: ConditionType, args: ConditionValue[]): ConditionalFormatRuleBuilder {- this._condition = {- type: criteria,- values: args,- };- return this;- }-- /**- * Clears the conditional format rule's gradient maxpoint value, and instead uses the maximum value in the rule's ranges. Also sets the gradient's maxpoint color to the input color.- */- setGradientMaxpoint(color: string): ConditionalFormatRuleBuilder {- this._maxPoint = {- colorStyle: {- rgb: color,- },- };-- return this;- }-- /**- * Sets the conditional format rule's gradient maxpoint fields.- */- setGradientMaxpointWithValue(color: string, type: InterpolationPointType, value: string): ConditionalFormatRuleBuilder {- this._maxPoint = {- colorStyle: {- rgb: color,- },- type,- value,- };-- return this;- }-- /**- * Sets the conditional format rule's gradient midpoint fields. Clears all of the midpoint fields if the passed in interpolation type is null.- */- setGradientMidpointWithValue(color: string, type: Nullable<InterpolationPointType>, value: string): ConditionalFormatRuleBuilder {- if (!type) {- this._midPoint = null;- } else {- this._midPoint = {- colorStyle: {- rgb: color,- },- type,- value,- };- }-- return this;- }-- /**- * Clears the conditional format rule's gradient minpoint value, and instead uses the minimum value in the rule's ranges. Also sets the gradient's minpoint color to the input color.- */- setGradientMinpoint(color: string): ConditionalFormatRuleBuilder {- this._minPoint = {- colorStyle: {- rgb: color,- },- };-- return this;- }-- /**- * Sets the conditional format rule's gradient minpoint fields.- */- setGradientMinpointWithValue(color: string, type: InterpolationPointType, value: string): ConditionalFormatRuleBuilder {- this._minPoint = {- colorStyle: {- rgb: color,- },- type,- value,- };-- return this;- }-}--// /**-// * Creates a builder for a conditional formatting rule.-// */-// newConditionalFormatRule(): ConditionalFormatRuleBuilder {-// return new ConditionalFormatRuleBuilder();-// }+// import { ConditionType, InterpolationPointType, Range, IRangeData, IStyleData, Nullable, RelativeDate } from '@univerjs/core';+// import { ConditionalFormatRule } from './ConditionalFormatRule';+// import { BooleanCondition, BooleanRule, ConditionValue, GradientRule, InterpolationPoint } from './IData/IConditionalFormatRule';-// /**-// * Get all conditional format rules in this sheet.-// */-// getConditionalFormatRules(): ConditionalFormatRule[] {-// const condition = this._config.conditionalFormats;-// const rules = [];-// for (let i = 0; i < condition.length; i++) {-// rules.push(-// new ConditionalFormatRule(condition[i].ranges, condition[i].rule)-// );-// }-// return rules;-// }+// export class ConditionalFormatRuleBuilder {+// private _ranges: IRangeData[];++// private _booleanRule: BooleanRule;++// private _gradientRule: GradientRule;++// private _format: IStyleData;++// private _condition: BooleanCondition;++// private _maxPoint: InterpolationPoint;-// /**-// * Replaces all currently existing conditional format rules in the sheet with the input rules. Rules are evaluated in their input order.-// */-// setConditionalFormatRules(rules: ConditionalFormatRule[]) {-// let ruleRange: IRangeData[] = [];-// for (let i = 0; i < rules.length; i++) {-// const rule = rules[i];-// const rangeList = rule.getRanges();-// const booleanConditon = rule.getBooleanCondition();-// const gradientCondition = rule.getGradientCondition();--// if (booleanConditon) {-// ruleRange = this._setBooleanCondtionRange(-// ruleRange,-// rangeList,-// booleanConditon-// );-// } else if (gradientCondition) {-// ruleRange = this._setGradientContionRange(-// ruleRange,-// rangeList,-// gradientCondition-// );+// private _minPoint: InterpolationPoint;++// private _midPoint: Nullable<InterpolationPoint>;++// /**+// * get condition of date format+// */+// private _getDate = (type: ConditionType, date: RelativeDate | Date) => {+// let value: ConditionValue;+// if (typeof date === 'object') {+// value = {+// userEnteredValue: (+date).toString(),+// };+// } else {+// value = {+// relativeDate: date,+// };// }+// this._condition = {+// type,+// values: [value],+// };+// };++// private _setBooleanRule() {+// this._booleanRule = {+// condition: this._condition,+// format: this._format,+// };+// }++// /**+// * get condition of text format+// */+// private _getText(type: ConditionType, value: string) {+// this._condition = {+// type,+// values: [+// {+// userEnteredValue: value,+// },+// ],+// };+// }++// /**+// * get condition of number format+// */+// private _getNumber(type: ConditionType, value: number[]) {+// const values: ConditionValue[] = [];+// for (let i = 0; i < value.length; i++) {+// values.push({+// userEnteredValue: value[i].toString(),+// });+// }+// this._condition = {+// type,+// values,+// };+// }++// constructor(ranges?: IRangeData[], rule?: BooleanRule | GradientRule) {+// this._ranges = ranges ?? [];+// if (rule) {+// if ('condition' in rule) {+// this._booleanRule = rule;+// } else {+// this._gradientRule = rule;+// }+// }+// }++// /**+// * Constructs a conditional format rule from the settings applied to the builder.+// */+// build(): ConditionalFormatRule {+// return new ConditionalFormatRule(this._ranges, this._booleanRule ?? this._gradientRule);+// }++// /**+// * Sets the background color for the conditional format rule's format. Passing in null removes the background color format setting from the rule.+// */+// setBackground(color: Nullable<string>): ConditionalFormatRuleBuilder {+// const bgColor = {+// rgb: color,+// };+// this._format.bg = bgColor;+// this._setBooleanRule();++// return this;+// }++// /**+// *+// * Sets text bolding for the conditional format rule's format. If bold is true, the rule bolds text if the condition is met; if false, the rule removes any existing bolding if the condition is met. Passing in null removes the bold format setting from the rule.+// */+// setBold(bold: Nullable<boolean>): ConditionalFormatRuleBuilder {+// if (bold === null) {+// delete this._format.bl;+// } else if (bold) {+// this._format.bl = 1;+// } else {+// this._format.bl = 0;+// }+// this._setBooleanRule();++// return this;+// }++// /**+// * Sets the font color for the conditional format rule's format. Passing in null removes the font color format setting from the rule.+// */+// setFontColor(color: Nullable<string>): ConditionalFormatRuleBuilder {+// const fontColor = {+// rgb: color,+// };+// this._format.cl = fontColor;+// this._setBooleanRule();++// return this;+// }++// /**+// * Sets text italics for the conditional format rule's format. If italic is true, the rule italicises text if the condition is met; if false, the rule removes any existing italicization if the condition is met. Passing in null removes the italic format setting from the rule.+// */+// setItalic(italic: Nullable<boolean>): ConditionalFormatRuleBuilder {+// if (italic === null) {+// delete this._format.it;+// } else if (italic) {+// this._format.it = 1;+// } else {+// this._format.it = 0;+// }+// this._setBooleanRule();++// return this;+// }++// /**+// * Sets one or more ranges to which this conditional format rule is applied. This operation replaces any existing ranges. Setting an empty array clears any existing ranges. A rule must have at least one range.+// */+// setRanges(ranges: Range[]): ConditionalFormatRuleBuilder {+// const range = [];+// for (let i = 0; i < ranges.length; i++) {+// range.push(ranges[i].getRangeData());+// }+// this._ranges = range;++// return this;+// }++// /**+// * Sets text strikethrough for the conditional format rule's format. If strikethrough is true, the rule strikesthrough text if the condition is met; if false, the rule removes any existing strikethrough formatting if the condition is met. Passing in null removes the strikethrough format setting from the rule.+// */+// setStrikethrough(strikethrough: Nullable<boolean>): ConditionalFormatRuleBuilder {+// if (!this._format.st) {+// this._format.st = { s: 1 };+// }++// if (strikethrough === null) {+// delete this._format.st;+// } else if (strikethrough) {+// this._format.st.s = 1;+// } else {+// this._format.st.s = 0;+// }+// this._setBooleanRule();++// return this;+// }++// /**+// * Sets text underlining for the conditional format rule's format. If underline is true, the rule underlines text if the condition is met; if false, the rule removes any existing underlines if the condition is met. Passing in null removes the underline format setting from the rule.+// */+// setUnderline(underline: Nullable<boolean>): ConditionalFormatRuleBuilder {+// if (!this._format.ul) {+// this._format.ul = { s: 1 };+// }++// if (underline === null) {+// delete this._format.st;+// } else if (underline) {+// this._format.ul.s = 1;+// } else {+// this._format.ul.s = 0;+// }+// this._setBooleanRule();++// return this;// }-// }-// private _setBooleanCondtionRange = (-// ranges: IRangeData[],-// rangeList: IRangeData[],-// booleanRule: BooleanRule-// ) => {-// const map = new Map([-// [-// ConditionType.CONDITION_TYPE_UNSPECIFIED,-// (cell: Nullable<ICellData>, values?: ConditionValue[]) => true,-// ],-// [ConditionType.BLANK, (cell) => !cell || cell.m === ''],-// [ConditionType.NOT_BLANK, (cell) => !!cell && !!cell.m],-// [-// ConditionType.DATE_AFTER,-// (cell, values) => {-// values = values!;-// if (cell && cell.fm && cell.fm.t === FormatType.DATE) {-// if ('relativeDate' in values[0]) {-// } else {-// if (cell.v && cell.v > values[0].userEnteredValue!) {-// return true;-// }-// }-// }-// return false;+// /**+// * Sets the conditional format rule to trigger when the cell is empty.+// */+// whenCellEmpty(): ConditionalFormatRuleBuilder {+// const type = ConditionType.BLANK;+// this._condition = {+// type,+// };++// return this;+// }++// /**+// * Sets the conditional format rule to trigger when the cell is not empty.+// */+// whenCellNotEmpty(): ConditionalFormatRuleBuilder {+// const type = ConditionType.NOT_BLANK;+// this._condition = {+// type,+// };++// return this;+// }++// /**+// * Sets the conditional format rule to trigger when a date is after the given value.+// */+// whenDateAfter(date: RelativeDate | Date): ConditionalFormatRuleBuilder {+// this._getDate(ConditionType.DATE_AFTER, date);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when a date is before the given date.+// */+// whenDateBefore(date: RelativeDate | Date): ConditionalFormatRuleBuilder {+// this._getDate(ConditionType.DATE_BEFORE, date);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when a date is equal to the given relative date.+// */+// whenDateEqualTo(date: RelativeDate | Date): ConditionalFormatRuleBuilder {+// this._getDate(ConditionType.DATE_EQ, date);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when a number falls between, or is either of, two specified values.+// */+// whenNumberBetween(start: number, end: number): ConditionalFormatRuleBuilder {+// let value: number[];+// if (start === end) {+// value = [start];+// } else if (start > end) {+// value = [end, start];+// } else {+// value = [start, end];+// }++// this._getNumber(ConditionType.NUMBER_BETWEEN, value);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when a number is equal to the given value.+// */+// whenNumberEqualTo(number: number): ConditionalFormatRuleBuilder {+// this._getNumber(ConditionType.NUMBER_EQ, [number]);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when a number is greater than the given value.+// */+// whenNumberGreaterThan(number: number): ConditionalFormatRuleBuilder {+// this._getNumber(ConditionType.NUMNUMBER_BETWEENR_GREATER, [number]);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when a number is greater than or equal to the given value.+// */+// whenNumberGreaterThanOrEqualTo(number: number): ConditionalFormatRuleBuilder {+// this._getNumber(ConditionType.NUMBER_GREATER_THAN_EQ, [number]);+// return this;+// }++// /**+// * Sets the conditional conditional format rule to trigger when a number less than the given value.+// */+// whenNumberLessThan(number: number): ConditionalFormatRuleBuilder {+// this._getNumber(ConditionType.NUMBER_LESS, [number]);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when a number less than or equal to the given value.+// */+// whenNumberLessThanOrEqualTo(number: number): ConditionalFormatRuleBuilder {+// this._getNumber(ConditionType.NUMBER_LESS_THAN_EQ, [number]);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when a number does not fall between, and is neither of, two specified values.+// */+// whenNumberNotBetween(start: number, end: number): ConditionalFormatRuleBuilder {+// let value: number[];+// if (start === end) {+// value = [start];+// } else if (start > end) {+// value = [end, start];+// } else {+// value = [start, end];+// }++// this._getNumber(ConditionType.NUMBER_NOT_BETWEEN, value);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when a number is not equal to the given value.+// */+// whenNumberNotEqualTo(number: number): ConditionalFormatRuleBuilder {+// this._getNumber(ConditionType.NUMBER_NOT_EQ, [number]);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when that the given formula evaluates to true.+// */+// whenFormulaSatisfied(formula: string): ConditionalFormatRuleBuilder {+// this._getText(ConditionType.CUSTOM_FORMULA, formula);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when that the input contains the given value.+// */+// whenTextContains(text: string): ConditionalFormatRuleBuilder {+// this._getText(ConditionType.TEXT_CONTAINS, text);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when that the input does not contain the given value.+// */+// whenTextDoesNotContain(text: string): ConditionalFormatRuleBuilder {+// this._getText(ConditionType.TEXT_NOT_CONTAINS, text);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when that the input ends with the given value.+// */+// whenTextEndsWith(text: string): ConditionalFormatRuleBuilder {+// this._getText(ConditionType.TEXT_ENDS_WITH, text);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when that the input is equal to the given value.+// */+// whenTextEqualTo(text: string): ConditionalFormatRuleBuilder {+// this._getText(ConditionType.TEXT_EQ, text);+// return this;+// }++// /**+// * Sets the conditional format rule to trigger when that the input starts with the given value.+// */+// whenTextStartsWith(text: string): ConditionalFormatRuleBuilder {+// this._getText(ConditionType.TEXT_STARTS_WITH, text);+// return this;+// }++// /**+// * Sets the conditional format rule to criteria defined by BooleanCriteria values, typically taken from the criteria and arguments of an existing rule.+// */+// withCriteria(criteria: ConditionType, args: ConditionValue[]): ConditionalFormatRuleBuilder {+// this._condition = {+// type: criteria,+// values: args,+// };+// return this;+// }++// /**+// * Clears the conditional format rule's gradient maxpoint value, and instead uses the maximum value in the rule's ranges. Also sets the gradient's maxpoint color to the input color.+// */+// setGradientMaxpoint(color: string): ConditionalFormatRuleBuilder {+// this._maxPoint = {+// colorStyle: {+// rgb: color,// },-// ],-// [-// ConditionType.DATE_BEFORE,-// (cell, values) => {-// values = values!;-// if (cell && cell.fm && cell.fm.t === FormatType.DATE) {-// if ('relativeDate' in values[0]) {-// } else {-// if (cell.v && cell.v < values[0].userEnteredValue!) {-// return true;-// }-// }-// }-// return false;+// };++// return this;+// }++// /**+// * Sets the conditional format rule's gradient maxpoint fields.+// */+// setGradientMaxpointWithValue(color: string, type: InterpolationPointType, value: string): ConditionalFormatRuleBuilder {+// this._maxPoint = {+// colorStyle: {+// rgb: color,// },-// ],-// [-// ConditionType.DATE_EQ,-// (cell, values) => {-// values = values!;-// if (cell && cell.fm && cell.fm.t === FormatType.DATE) {-// if ('relativeDate' in values[0]) {-// } else {-// if (cell.v == values[0].userEnteredValue!) {-// return true;-// }-// }-// }-// return false;+// type,+// value,+// };++// return this;+// }++// /**+// * Sets the conditional format rule's gradient midpoint fields. Clears all of the midpoint fields if the passed in interpolation type is null.+// */+// setGradientMidpointWithValue(color: string, type: Nullable<InterpolationPointType>, value: string): ConditionalFormatRuleBuilder {+// if (!type) {+// this._midPoint = null;+// } else {+// this._midPoint = {+// colorStyle: {+// rgb: color,+// },+// type,+// value,+// };+// }++// return this;+// }++// /**+// * Clears the conditional format rule's gradient minpoint value, and instead uses the minimum value in the rule's ranges. Also sets the gradient's minpoint color to the input color.+// */+// setGradientMinpoint(color: string): ConditionalFormatRuleBuilder {+// this._minPoint = {+// colorStyle: {+// rgb: color,// },-// ],-// [-// ConditionType.NUMBER_BETWEEN,-// (cell, values) =>-// cell &&-// cell.v &&-// values &&-// cell.v > values[0].userEnteredValue! &&-// cell.v < values[1].userEnteredValue!,-// ],-// [-// ConditionType.NUMBER_EQ,-// (cell, values) =>-// cell && values && cell.v == values[0].userEnteredValue!,-// ],-// [-// ConditionType.NUMNUMBER_BETWEENR_GREATER,-// (cell, values) =>-// cell && cell.v && values && cell.v > values[0].userEnteredValue!,-// ],-// [-// ConditionType.NUMBER_GREATER_THAN_EQ,-// (cell, values) =>-// cell &&-// cell.v &&-// values &&-// cell.v >= values[0].userEnteredValue!,-// ],-// [-// ConditionType.NUMBER_GREATER_THAN_EQ,-// (cell, values) =>-// values &&-// cell &&-// cell.v &&-// cell.v >= values[0].userEnteredValue!,-// ],-// [-// ConditionType.NUMBER_LESS,-// (cell, values) =>-// values && cell && cell.v && cell.v < values[0].userEnteredValue!,-// ],-// [-// ConditionType.NUMBER_LESS_THAN_EQ,-// (cell, values) =>-// values &&-// cell &&-// cell.v &&-// cell.v <= values[0].userEnteredValue!,-// ],-// [-// ConditionType.NUMBER_NOT_BETWEEN,-// (cell, values) =>-// values &&-// cell &&-// cell.v &&-// (cell.v < values[0].userEnteredValue! ||-// cell.v > values[1].userEnteredValue!),-// ],-// [-// ConditionType.NUMBER_NOT_EQ,-// (cell, values) =>-// values && cell && cell.v != values[0].userEnteredValue!,-// ],-// [-// ConditionType.CUSTOM_FORMULA,-// (cell, values) =>-// values && cell && cell.f == values[0].userEnteredValue!,-// ],-// [-// ConditionType.TEXT_CONTAINS,-// (cell, values) =>-// values && cell && cell.m?.includes(values[0].userEnteredValue!),-// ],-// [-// ConditionType.TEXT_NOT_CONTAINS,-// (cell, values) =>-// values &&-// (!cell ||-// !cell.m ||-// !cell.m.includes(values[0].userEnteredValue!)),-// ],-// [-// ConditionType.TEXT_ENDS_WITH,-// (cell, values) =>-// values &&-// cell &&-// cell.m &&-// new RegExp(values[0].userEnteredValue! + '$').test(cell.m),-// ],-// ]);--// for (let i = 0; i < rangeList.length; i++) {-// const range = new Range(this, rangeList[i]);-// const matrix = range.getMatrix();-// range.forEach((row, column) => {-// const cell = matrix.getValue(row, column);-// const condition = map.get(booleanRule.condition.type)!(-// cell,-// booleanRule.condition.values-// );-// if (condition) {-// ranges.push({-// startRow: row,-// endRow: row,-// startColumn: column,-// endColumn: column,-// });-// }-// });+// };++// return this;// }-// return ranges;-// };+// /**+// * Sets the conditional format rule's gradient minpoint fields.+// */+// setGradientMinpointWithValue(color: string, type: InterpolationPointType, value: string): ConditionalFormatRuleBuilder {+// this._minPoint = {+// colorStyle: {+// rgb: color,+// },+// type,+// value,+// };++// return this;+// }+// }-// private _setGradientContionRange = (-// ranges: IRangeData[],-// rangeList: IRangeData[],-// booleanRule: GradientRule-// ) => {-// return ranges;-// };+// // /**+// // * Creates a builder for a conditional formatting rule.+// // */+// // newConditionalFormatRule(): ConditionalFormatRuleBuilder {+// // return new ConditionalFormatRuleBuilder();+// // }++// // /**+// // * Get all conditional format rules in this sheet.+// // */+// // getConditionalFormatRules(): ConditionalFormatRule[] {+// // const condition = this._config.conditionalFormats;+// // const rules = [];+// // for (let i = 0; i < condition.length; i++) {+// // rules.push(+// // new ConditionalFormatRule(condition[i].ranges, condition[i].rule)+// // );+// // }+// // return rules;+// // }++// // /**+// // * Replaces all currently existing conditional format rules in the sheet with the input rules. Rules are evaluated in their input order.+// // */+// // setConditionalFormatRules(rules: ConditionalFormatRule[]) {+// // let ruleRange: IRangeData[] = [];+// // for (let i = 0; i < rules.length; i++) {+// // const rule = rules[i];+// // const rangeList = rule.getRanges();+// // const booleanConditon = rule.getBooleanCondition();+// // const gradientCondition = rule.getGradientCondition();++// // if (booleanConditon) {+// // ruleRange = this._setBooleanCondtionRange(+// // ruleRange,+// // rangeList,+// // booleanConditon+// // );+// // } else if (gradientCondition) {+// // ruleRange = this._setGradientContionRange(+// // ruleRange,+// // rangeList,+// // gradientCondition+// // );+// // }+// // }+// // }++// // private _setBooleanCondtionRange = (+// // ranges: IRangeData[],+// // rangeList: IRangeData[],+// // booleanRule: BooleanRule+// // ) => {+// // const map = new Map([+// // [+// // ConditionType.CONDITION_TYPE_UNSPECIFIED,+// // (cell: Nullable<ICellData>, values?: ConditionValue[]) => true,+// // ],+// // [ConditionType.BLANK, (cell) => !cell || cell.m === ''],+// // [ConditionType.NOT_BLANK, (cell) => !!cell && !!cell.m],+// // [+// // ConditionType.DATE_AFTER,+// // (cell, values) => {+// // values = values!;+// // if (cell && cell.fm && cell.fm.t === FormatType.DATE) {+// // if ('relativeDate' in values[0]) {+// // } else {+// // if (cell.v && cell.v > values[0].userEnteredValue!) {+// // return true;+// // }+// // }+// // }+// // return false;+// // },+// // ],+// // [+// // ConditionType.DATE_BEFORE,+// // (cell, values) => {+// // values = values!;+// // if (cell && cell.fm && cell.fm.t === FormatType.DATE) {+// // if ('relativeDate' in values[0]) {+// // } else {+// // if (cell.v && cell.v < values[0].userEnteredValue!) {+// // return true;+// // }+// // }+// // }+// // return false;+// // },+// // ],+// // [+// // ConditionType.DATE_EQ,+// // (cell, values) => {+// // values = values!;+// // if (cell && cell.fm && cell.fm.t === FormatType.DATE) {+// // if ('relativeDate' in values[0]) {+// // } else {+// // if (cell.v == values[0].userEnteredValue!) {+// // return true;+// // }+// // }+// // }+// // return false;+// // },+// // ],+// // [+// // ConditionType.NUMBER_BETWEEN,+// // (cell, values) =>+// // cell &&+// // cell.v &&+// // values &&+// // cell.v > values[0].userEnteredValue! &&+// // cell.v < values[1].userEnteredValue!,+// // ],+// // [+// // ConditionType.NUMBER_EQ,+// // (cell, values) =>+// // cell && values && cell.v == values[0].userEnteredValue!,+// // ],+// // [+// // ConditionType.NUMNUMBER_BETWEENR_GREATER,+// // (cell, values) =>+// // cell && cell.v && values && cell.v > values[0].userEnteredValue!,+// // ],+// // [+// // ConditionType.NUMBER_GREATER_THAN_EQ,+// // (cell, values) =>+// // cell &&+// // cell.v &&+// // values &&+// // cell.v >= values[0].userEnteredValue!,+// // ],+// // [+// // ConditionType.NUMBER_GREATER_THAN_EQ,+// // (cell, values) =>+// // values &&+// // cell &&+// // cell.v &&+// // cell.v >= values[0].userEnteredValue!,+// // ],+// // [+// // ConditionType.NUMBER_LESS,+// // (cell, values) =>+// // values && cell && cell.v && cell.v < values[0].userEnteredValue!,+// // ],+// // [+// // ConditionType.NUMBER_LESS_THAN_EQ,+// // (cell, values) =>+// // values &&+// // cell &&+// // cell.v &&+// // cell.v <= values[0].userEnteredValue!,+// // ],+// // [+// // ConditionType.NUMBER_NOT_BETWEEN,+// // (cell, values) =>+// // values &&+// // cell &&+// // cell.v &&+// // (cell.v < values[0].userEnteredValue! ||+// // cell.v > values[1].userEnteredValue!),+// // ],+// // [+// // ConditionType.NUMBER_NOT_EQ,+// // (cell, values) =>+// // values && cell && cell.v != values[0].userEnteredValue!,+// // ],+// // [+// // ConditionType.CUSTOM_FORMULA,+// // (cell, values) =>+// // values && cell && cell.f == values[0].userEnteredValue!,+// // ],+// // [+// // ConditionType.TEXT_CONTAINS,+// // (cell, values) =>+// // values && cell && cell.m?.includes(values[0].userEnteredValue!),+// // ],+// // [+// // ConditionType.TEXT_NOT_CONTAINS,+// // (cell, values) =>+// // values &&+// // (!cell ||+// // !cell.m ||+// // !cell.m.includes(values[0].userEnteredValue!)),+// // ],+// // [+// // ConditionType.TEXT_ENDS_WITH,+// // (cell, values) =>+// // values &&+// // cell &&+// // cell.m &&+// // new RegExp(values[0].userEnteredValue! + '$').test(cell.m),+// // ],+// // ]);++// // for (let i = 0; i < rangeList.length; i++) {+// // const range = new Range(this, rangeList[i]);+// // const matrix = range.getMatrix();+// // range.forEach((row, column) => {+// // const cell = matrix.getValue(row, column);+// // const condition = map.get(booleanRule.condition.type)!(+// // cell,+// // booleanRule.condition.values+// // );+// // if (condition) {+// // ranges.push({+// // startRow: row,+// // endRow: row,+// // startColumn: column,+// // endColumn: column,+// // });+// // }+// // });+// // }++// // return ranges;+// // };++// // private _setGradientContionRange = (+// // ranges: IRangeData[],+// // rangeList: IRangeData[],+// // booleanRule: GradientRule+// // ) => {+// // return ranges;+// // };diff --git a/packages/sheets-plugin-conditional-format/src/UI/ConditionContent.tsx b/packages/sheets-plugin-conditional-format/src/UI/ConditionContent.tsxindex 384fb78388..c608b185f6 100644--- a/packages/sheets-plugin-conditional-format/src/UI/ConditionContent.tsx+++ b/packages/sheets-plugin-conditional-format/src/UI/ConditionContent.tsx@@ -1,350 +1,350 @@-import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';-import { IKeyValue, Nullable, Observer, Workbook } from '@univerjs/core';-import { SheetPlugin } from '@univerjs/base-sheets';+// import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';+// import { IKeyValue, Nullable, Observer, Workbook } from '@univerjs/core';+// import { SheetPlugin } from '@univerjs/base-sheets';-import styles from './index.module.less';+// import styles from './index.module.less';-type ConditionContentProps = {- config?: any;- type: string;- genre: string;-};+// type ConditionContentProps = {+// config?: any;+// type: string;+// genre: string;+// };-// TODO: remove IKeyValue-type ConditionContentState = {- condition: ConditionProps;- setting: Record<string, LabelProps>;- duplicateOption: LabelProps[];-} & IKeyValue;+// // TODO: remove IKeyValue+// type ConditionContentState = {+// condition: ConditionProps;+// setting: Record<string, LabelProps>;+// duplicateOption: LabelProps[];+// } & IKeyValue;-type LabelProps = {- locale?: string;- label?: string;- value?: string;-};-type ConditionProps = {- title: string;- subtitle: string;- to?: string;- prefix?: string;- suffix?: string;-};+// type LabelProps = {+// locale?: string;+// label?: string;+// value?: string;+// };+// type ConditionProps = {+// title: string;+// subtitle: string;+// to?: string;+// prefix?: string;+// suffix?: string;+// };-export class ConditionContent extends Component<ConditionContentProps, ConditionContentState> {- private _localeObserver: Nullable<Observer<Workbook>>;+// export class ConditionContent extends Component<ConditionContentProps, ConditionContentState> {+// private _localeObserver: Nullable<Observer<Workbook>>;- Render: BaseComponentRender;+// Render: BaseComponentRender;- initialize() {- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();+// initialize() {+// const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();- this.state = {- greater: {- title: {- locale: 'conditionalformat.conditionalformat_greaterThan',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_greaterThan_title',- },- },- less: {- title: {- locale: 'conditionalformat.conditionalformat_lessThan',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_lessThan_title',- },- },- between: {- title: {- locale: 'conditionalformat.conditionalformat_betweenness',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_betweenness_title',- },- to: {- locale: 'conditionalformat.to',- },- },- equal: {- title: {- locale: 'conditionalformat.conditionalformat_equal',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_equal_title',- },- },- text: {- title: {- locale: 'conditionalformat.conditionalformat_textContains',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_textContains_title',- },- },- date: {- title: {- locale: 'conditionalformat.conditionalformat_occurrenceDate',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_occurrenceDate_title',- },- },- duplicate: {- title: {- locale: 'conditionalformat.conditionalformat_duplicateValue',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_duplicateValue_title',- },- },- top10: {- title: {- locale: 'conditionalformat.conditionalformat_top10',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_top10_title',- },- prefix: {- locale: 'conditionalformat.top',- },- suffix: {- locale: 'conditionalformat.oneself',- },- },- top10_percent: {- title: {- locale: 'conditionalformat.conditionalformat_top10_percent',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_top10_title',- },- prefix: {- locale: 'conditionalformat.top',- },- },- last10: {- title: {- locale: 'conditionalformat.conditionalformat_last10',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_last10_title',- },- prefix: {- locale: 'conditionalformat.last',- },- suffix: {- locale: 'conditionalformat.oneself',- },- },- last10_percent: {- title: {- locale: 'conditionalformat.conditionalformat_last10_percent',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_last10_title',- },- prefix: {- locale: 'conditionalformat.last',- },- },- above: {- title: {- locale: 'conditionalformat.conditionalformat_AboveAverage',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_AboveAverage_title',- },- },- below: {- title: {- locale: 'conditionalformat.conditionalformat_SubAverage',- },- subtitle: {- locale: 'conditionalformat.conditionalformat_SubAverage_title',- },- },- setting: {- setAs: {- locale: 'conditionalformat.setAs',- label: '',- },- setAreaAs: {- locale: 'conditionalformat.setAsByArea',- label: '',- },- textColor: { locale: 'conditionalformat.textColor' },- cellColor: { locale: 'conditionalformat.cellColor' },- },- condition: {- title: '',- subtitle: '',- to: '',- prefix: '',- suffix: '',- },- duplicateOption: [- {- locale: 'conditionalformat.duplicateValue.text',- value: '',- label: '',- },- {- locale: 'conditionalformat.uniqueValue',- value: '',- label: '',- },- ],- };- }+// this.state = {+// greater: {+// title: {+// locale: 'conditionalformat.conditionalformat_greaterThan',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_greaterThan_title',+// },+// },+// less: {+// title: {+// locale: 'conditionalformat.conditionalformat_lessThan',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_lessThan_title',+// },+// },+// between: {+// title: {+// locale: 'conditionalformat.conditionalformat_betweenness',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_betweenness_title',+// },+// to: {+// locale: 'conditionalformat.to',+// },+// },+// equal: {+// title: {+// locale: 'conditionalformat.conditionalformat_equal',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_equal_title',+// },+// },+// text: {+// title: {+// locale: 'conditionalformat.conditionalformat_textContains',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_textContains_title',+// },+// },+// date: {+// title: {+// locale: 'conditionalformat.conditionalformat_occurrenceDate',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_occurrenceDate_title',+// },+// },+// duplicate: {+// title: {+// locale: 'conditionalformat.conditionalformat_duplicateValue',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_duplicateValue_title',+// },+// },+// top10: {+// title: {+// locale: 'conditionalformat.conditionalformat_top10',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_top10_title',+// },+// prefix: {+// locale: 'conditionalformat.top',+// },+// suffix: {+// locale: 'conditionalformat.oneself',+// },+// },+// top10_percent: {+// title: {+// locale: 'conditionalformat.conditionalformat_top10_percent',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_top10_title',+// },+// prefix: {+// locale: 'conditionalformat.top',+// },+// },+// last10: {+// title: {+// locale: 'conditionalformat.conditionalformat_last10',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_last10_title',+// },+// prefix: {+// locale: 'conditionalformat.last',+// },+// suffix: {+// locale: 'conditionalformat.oneself',+// },+// },+// last10_percent: {+// title: {+// locale: 'conditionalformat.conditionalformat_last10_percent',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_last10_title',+// },+// prefix: {+// locale: 'conditionalformat.last',+// },+// },+// above: {+// title: {+// locale: 'conditionalformat.conditionalformat_AboveAverage',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_AboveAverage_title',+// },+// },+// below: {+// title: {+// locale: 'conditionalformat.conditionalformat_SubAverage',+// },+// subtitle: {+// locale: 'conditionalformat.conditionalformat_SubAverage_title',+// },+// },+// setting: {+// setAs: {+// locale: 'conditionalformat.setAs',+// label: '',+// },+// setAreaAs: {+// locale: 'conditionalformat.setAsByArea',+// label: '',+// },+// textColor: { locale: 'conditionalformat.textColor' },+// cellColor: { locale: 'conditionalformat.cellColor' },+// },+// condition: {+// title: '',+// subtitle: '',+// to: '',+// prefix: '',+// suffix: '',+// },+// duplicateOption: [+// {+// locale: 'conditionalformat.duplicateValue.text',+// value: '',+// label: '',+// },+// {+// locale: 'conditionalformat.uniqueValue',+// value: '',+// label: '',+// },+// ],+// };+// }- setLocale() {- // setLocale for diffrent type of modal- const locale = this._context.getLocale();- const genre = this.props.genre;+// setLocale() {+// // setLocale for diffrent type of modal+// const locale = this._context.getLocale();+// const genre = this.props.genre;- function getLabel(obj: object) {- Object.keys(obj).forEach((item) => {- obj[item].label = locale.get(obj[item].locale);- });- }+// function getLabel(obj: object) {+// Object.keys(obj).forEach((item) => {+// obj[item].label = locale.get(obj[item].locale);+// });+// }- this.setState((prevState) => {- let { setting, condition, duplicateOption } = prevState;- // set for condition- let obj = prevState[genre];- getLabel(obj);- getLabel(setting);- condition.title = obj.title.label;- condition.subtitle = obj.subtitle.label;- if (obj.to) condition.to = obj.to.label;- if (obj.prefix) condition.prefix = obj.prefix.label;- if (obj.suffix) condition.suffix = obj.suffix.label;+// this.setState((prevState) => {+// let { setting, condition, duplicateOption } = prevState;+// // set for condition+// let obj = prevState[genre];+// getLabel(obj);+// getLabel(setting);+// condition.title = obj.title.label;+// condition.subtitle = obj.subtitle.label;+// if (obj.to) condition.to = obj.to.label;+// if (obj.prefix) condition.prefix = obj.prefix.label;+// if (obj.suffix) condition.suffix = obj.suffix.label;- // set for duplicateOption- duplicateOption.forEach((item) => {- if (item) {- item.label = locale.get(item.locale || '');- }- });+// // set for duplicateOption+// duplicateOption.forEach((item) => {+// if (item) {+// item.label = locale.get(item.locale || '');+// }+// });- return {- // render modal's Locale- condition,- duplicateOption,- };- });- }+// return {+// // render modal's Locale+// condition,+// duplicateOption,+// };+// });+// }- componentWillMount() {- this.setLocale();+// componentWillMount() {+// this.setLocale();- // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }+// // subscribe Locale change event+// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }- setValue = (value: object, fn?: () => void) => {- this.setState(- (prevState) => ({- ...value,- }),- fn- );- };+// setValue = (value: object, fn?: () => void) => {+// this.setState(+// (prevState) => ({+// ...value,+// }),+// fn+// );+// };- pickTextColor = () => {};+// pickTextColor = () => {};- pickCellColor = () => {};+// pickCellColor = () => {};- cancelColor = () => {};+// cancelColor = () => {};- // render different type of modal's rangepicker- getCellRange = () => {- const CellRangeModal = this.Render.renderFunction('CellRangeModal');- const { type } = this.props;- const { condition, duplicateOption, setting } = this.state;- if (type === 'text') {- return (- <>- <CellRangeModal></CellRangeModal>- <p className={styles.setAs}>{setting.setAs.label}</p>- </>- );- }- if (type === 'between') {- return (- <>- <div className={styles.conditionBetween}>- <CellRangeModal></CellRangeModal>- <span>{condition.to}</span>- <CellRangeModal></CellRangeModal>- </div>- <p className={styles.setAs}>{setting.setAs.label}</p>- </>- );- }- if (type === 'select') {- return (- <>- <select>- {duplicateOption.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- <p className={styles.setAs}>{setting.setAs.label}</p>- </>- );- }- if (type === 'input') {- const Input = this.Render.renderFunction('Input');- return (- <>- <div className={styles.conditionInput}>- <span>{condition.prefix}</span>- <Input placeholder="10" />- <span>{condition.suffix ? condition.suffix : '%'}</span>- </div>- <p className={styles.setAs}>{setting.setAs.label}</p>- </>- );- }- if (type === 'none') {- return <p>{setting.setAreaAs.label}:</p>;- }- };+// // render different type of modal's rangepicker+// getCellRange = () => {+// const CellRangeModal = this.Render.renderFunction('CellRangeModal');+// const { type } = this.props;+// const { condition, duplicateOption, setting } = this.state;+// if (type === 'text') {+// return (+// <>+// <CellRangeModal></CellRangeModal>+// <p className={styles.setAs}>{setting.setAs.label}</p>+// </>+// );+// }+// if (type === 'between') {+// return (+// <>+// <div className={styles.conditionBetween}>+// <CellRangeModal></CellRangeModal>+// <span>{condition.to}</span>+// <CellRangeModal></CellRangeModal>+// </div>+// <p className={styles.setAs}>{setting.setAs.label}</p>+// </>+// );+// }+// if (type === 'select') {+// return (+// <>+// <select>+// {duplicateOption.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// <p className={styles.setAs}>{setting.setAs.label}</p>+// </>+// );+// }+// if (type === 'input') {+// const Input = this.Render.renderFunction('Input');+// return (+// <>+// <div className={styles.conditionInput}>+// <span>{condition.prefix}</span>+// <Input placeholder="10" />+// <span>{condition.suffix ? condition.suffix : '%'}</span>+// </div>+// <p className={styles.setAs}>{setting.setAs.label}</p>+// </>+// );+// }+// if (type === 'none') {+// return <p>{setting.setAreaAs.label}:</p>;+// }+// };- render(props: ConditionContentProps, state: ConditionContentState) {- const Checkbox = this.Render.renderFunction('Checkbox');- const ColorPicker = this.Render.renderFunction('ColorPicker');- const { condition, setting } = state;- return (- <div className={styles.conditionContent}>- <p className={styles.conditionTitle}>{condition.title}</p>- <div className={styles.conditionSubtitle}>- <p className={styles.setBold}>{condition.subtitle}:</p>- {this.getCellRange()}- </div>- <div className={styles.colorBox}>- <div className={styles.colorItem}>- <Checkbox>{setting.textColor.label}</Checkbox>- <ColorPicker color="#9c0006" onClick={this.pickTextColor} onCancel={this.cancelColor}></ColorPicker>- </div>- <div className={styles.colorItem}>- <Checkbox>{setting.cellColor.label}</Checkbox>- <ColorPicker color="#ffc7ce" onClick={this.pickCellColor} onCancel={this.cancelColor}></ColorPicker>- </div>- </div>- </div>- );- }-}+// render(props: ConditionContentProps, state: ConditionContentState) {+// const Checkbox = this.Render.renderFunction('Checkbox');+// const ColorPicker = this.Render.renderFunction('ColorPicker');+// const { condition, setting } = state;+// return (+// <div className={styles.conditionContent}>+// <p className={styles.conditionTitle}>{condition.title}</p>+// <div className={styles.conditionSubtitle}>+// <p className={styles.setBold}>{condition.subtitle}:</p>+// {this.getCellRange()}+// </div>+// <div className={styles.colorBox}>+// <div className={styles.colorItem}>+// <Checkbox>{setting.textColor.label}</Checkbox>+// <ColorPicker color="#9c0006" onClick={this.pickTextColor} onCancel={this.cancelColor}></ColorPicker>+// </div>+// <div className={styles.colorItem}>+// <Checkbox>{setting.cellColor.label}</Checkbox>+// <ColorPicker color="#ffc7ce" onClick={this.pickCellColor} onCancel={this.cancelColor}></ColorPicker>+// </div>+// </div>+// </div>+// );+// }+// }diff --git a/packages/sheets-plugin-conditional-format/src/UI/ConditionalFormatButton.tsx b/packages/sheets-plugin-conditional-format/src/UI/ConditionalFormatButton.tsxindex 0ed98034a2..db1b642ad8 100644--- a/packages/sheets-plugin-conditional-format/src/UI/ConditionalFormatButton.tsx+++ b/packages/sheets-plugin-conditional-format/src/UI/ConditionalFormatButton.tsx@@ -1,397 +1,397 @@-import { BaseComponentRender, BaseComponentSheet, BaseSelectProps, Component, ModalProps } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { SheetPlugin } from '@univerjs/base-sheets';+// import { BaseComponentRender, BaseComponentSheet, BaseSelectProps, Component, ModalProps } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { SheetPlugin } from '@univerjs/base-sheets';-import { IProps } from '../IData/IConditionalFormat';-import { ConditionContent } from './ConditionContent';-import { IconContent } from './IconContent';-import { ImageList } from './ImageList';-import { RuleContent } from './RuleContent';-import { RuleManage } from './RuleManage';+// import { IProps } from '../IData/IConditionalFormat';+// import { ConditionContent } from './ConditionContent';+// import { IconContent } from './IconContent';+// import { ImageList } from './ImageList';+// import { RuleContent } from './RuleContent';+// import { RuleManage } from './RuleManage';-// Types for state-interface IState {- conditionalFormat: ConditionButtonProps;- modalData: ModalProps[];-}+// // Types for state+// interface IState {+// conditionalFormat: ConditionButtonProps;+// modalData: ModalProps[];+// }-type ConditionButtonProps = {- locale?: string;- iconName?: string;- label?: string | JSX.Element;- value?: string;- icon?: JSX.Element | string | null | undefined;- type?: string;- tooltip?: string;- border?: boolean;- show?: boolean;- children?: ConditionButtonProps[];- className?: string;- onClick?: (...arg: any[]) => void;- style?: JSX.CSSProperties;- genre?: string;-};+// type ConditionButtonProps = {+// locale?: string;+// iconName?: string;+// label?: string | JSX.Element;+// value?: string;+// icon?: JSX.Element | string | null | undefined;+// type?: string;+// tooltip?: string;+// border?: boolean;+// show?: boolean;+// children?: ConditionButtonProps[];+// className?: string;+// onClick?: (...arg: any[]) => void;+// style?: JSX.CSSProperties;+// genre?: string;+// };-export class ConditionalFormatButton extends Component<IProps, IState> {- private _localeObserver: Nullable<Observer<Workbook>>;+// export class ConditionalFormatButton extends Component<IProps, IState> {+// private _localeObserver: Nullable<Observer<Workbook>>;- Render: BaseComponentRender;+// Render: BaseComponentRender;- initialize(props: IProps) {- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();- const ConditionalFormatIcon = this.Render.renderFunction('ConditionalFormatIcon');- const NextIcon = this.Render.renderFunction('NextIcon');- const RightIcon = this.Render.renderFunction('RightIcon');+// initialize(props: IProps) {+// const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();+// const ConditionalFormatIcon = this.Render.renderFunction('ConditionalFormatIcon');+// const NextIcon = this.Render.renderFunction('NextIcon');+// const RightIcon = this.Render.renderFunction('RightIcon');- // super(props);+// // super(props);- this.state = {- conditionalFormat: {- locale: 'conditionalformat.conditionalFormatLabel',- type: 'select',- label: <ConditionalFormatIcon />,- icon: <NextIcon />,- show: true,- children: [- {- locale: 'conditionalformat.highlightCellRules',- icon: <RightIcon />,- onClick: this.showContentModal,- children: [- {- locale: 'conditionalformat.greaterThan.text',- iconName: 'conditionalformat.greaterThan.example',- type: 'text',- genre: 'greater',- },- {- locale: 'conditionalformat.lessThan.text',- iconName: 'conditionalformat.lessThan.example',- type: 'text',- genre: 'less',- },- {- locale: 'conditionalformat.between.text',- iconName: 'conditionalformat.between.example',- type: 'between',- genre: 'between',- },- {- locale: 'conditionalformat.equal.text',- iconName: 'conditionalformat.equal.example',- type: 'text',- genre: 'equal',- },- {- locale: 'conditionalformat.textContains.text',- iconName: 'conditionalformat.textContains.example',- type: 'text',- genre: 'text',- },- {- locale: 'conditionalformat.occurrence.text',- iconName: 'conditionalformat.occurrence.example',- type: 'date',- genre: 'date',- },- {- locale: 'conditionalformat.duplicateValue.text',- iconName: 'conditionalformat.duplicateValue.example',- type: 'select',- genre: 'duplicate',- },- ],- },- {- locale: 'conditionalformat.itemSelectionRules',- icon: <RightIcon />,- onClick: this.showContentModal,- children: [- {- locale: 'conditionalformat.top10.text',- iconName: 'conditionalformat.top10.example',- type: 'input',- genre: 'top10',- },- {- locale: 'conditionalformat.top10_percent.text',- iconName: 'conditionalformat.top10_percent.example',- type: 'input',- genre: 'top10_percent',- },- {- locale: 'conditionalformat.last10.text',- iconName: 'conditionalformat.last10.example',- type: 'input',- genre: 'last10',- },- {- locale: 'conditionalformat.last10_percent.text',- iconName: 'conditionalformat.last10_percent.example',- type: 'input',- genre: 'last10_percent',- },- {- locale: 'conditionalformat.aboveAverage.text',- iconName: 'conditionalformat.aboveAverage.example',- type: 'none',- genre: 'above',- },- {- locale: 'conditionalformat.belowAverage.text',- iconName: 'conditionalformat.belowAverage.example',- type: 'none',- genre: 'below',- },- ],- },- {- locale: 'conditionalformat.dataBar',- icon: <RightIcon />,- children: [- {- label: <ImageList config={this.props.config} type="data"></ImageList>,- className: 'univer-image-li',- },- ],- },- {- locale: 'conditionalformat.colorGradation',- icon: <RightIcon />,- children: [- {- label: <ImageList config={this.props.config} type="color"></ImageList>,- className: 'univer-image-li',- },- ],- },- {- locale: 'conditionalformat.icons',- onClick: this.showIconModal,- },- {- locale: 'conditionalformat.newRule',- onClick: this.showRuleModal,- border: true,- },- {- locale: 'conditionalformat.deleteRule',- icon: <RightIcon />,- children: [- {- locale: 'conditionalformat.deleteSheetRule',- },- ],- },- {- locale: 'conditionalformat.manageRules',- onClick: this.showManageModal,- },- ],- },- modalData: [- {- show: false,- group: [- {- locale: 'button.confirm',- type: 'primary',- },- {- locale: 'button.cancel',- },- ],- children: <ConditionContent config={this.props.config} type="text" genre="greater" />,- onCancel: () => {- this.showModal(0, false);- },- },- {- locale: 'conditionalformat.icons',- show: false,- group: [- {- locale: 'button.cancel',- },- ],- children: <IconContent config={this.props.config} />,- onCancel: () => {- this.showModal(1, false);- },- },- {- locale: 'conditionalformat.newFormatRule',- show: false,- group: [- {- locale: 'button.confirm',- type: 'primary',- },- {- locale: 'button.cancel',- },- ],- children: <RuleContent config={this.props.config} />,- onCancel: () => {- this.showModal(2, false);- },- },- {- locale: 'conditionalformat.conditionalformatManageRules',- show: false,- group: [- {- locale: 'button.confirm',- type: 'primary',- },- {- locale: 'button.cancel',- },- ],- children: <RuleManage config={this.props.config} />,- onCancel: () => {- this.showModal(3, false);- },- },- ],- };- }+// this.state = {+// conditionalFormat: {+// locale: 'conditionalformat.conditionalFormatLabel',+// type: 'select',+// label: <ConditionalFormatIcon />,+// icon: <NextIcon />,+// show: true,+// children: [+// {+// locale: 'conditionalformat.highlightCellRules',+// icon: <RightIcon />,+// onClick: this.showContentModal,+// children: [+// {+// locale: 'conditionalformat.greaterThan.text',+// iconName: 'conditionalformat.greaterThan.example',+// type: 'text',+// genre: 'greater',+// },+// {+// locale: 'conditionalformat.lessThan.text',+// iconName: 'conditionalformat.lessThan.example',+// type: 'text',+// genre: 'less',+// },+// {+// locale: 'conditionalformat.between.text',+// iconName: 'conditionalformat.between.example',+// type: 'between',+// genre: 'between',+// },+// {+// locale: 'conditionalformat.equal.text',+// iconName: 'conditionalformat.equal.example',+// type: 'text',+// genre: 'equal',+// },+// {+// locale: 'conditionalformat.textContains.text',+// iconName: 'conditionalformat.textContains.example',+// type: 'text',+// genre: 'text',+// },+// {+// locale: 'conditionalformat.occurrence.text',+// iconName: 'conditionalformat.occurrence.example',+// type: 'date',+// genre: 'date',+// },+// {+// locale: 'conditionalformat.duplicateValue.text',+// iconName: 'conditionalformat.duplicateValue.example',+// type: 'select',+// genre: 'duplicate',+// },+// ],+// },+// {+// locale: 'conditionalformat.itemSelectionRules',+// icon: <RightIcon />,+// onClick: this.showContentModal,+// children: [+// {+// locale: 'conditionalformat.top10.text',+// iconName: 'conditionalformat.top10.example',+// type: 'input',+// genre: 'top10',+// },+// {+// locale: 'conditionalformat.top10_percent.text',+// iconName: 'conditionalformat.top10_percent.example',+// type: 'input',+// genre: 'top10_percent',+// },+// {+// locale: 'conditionalformat.last10.text',+// iconName: 'conditionalformat.last10.example',+// type: 'input',+// genre: 'last10',+// },+// {+// locale: 'conditionalformat.last10_percent.text',+// iconName: 'conditionalformat.last10_percent.example',+// type: 'input',+// genre: 'last10_percent',+// },+// {+// locale: 'conditionalformat.aboveAverage.text',+// iconName: 'conditionalformat.aboveAverage.example',+// type: 'none',+// genre: 'above',+// },+// {+// locale: 'conditionalformat.belowAverage.text',+// iconName: 'conditionalformat.belowAverage.example',+// type: 'none',+// genre: 'below',+// },+// ],+// },+// {+// locale: 'conditionalformat.dataBar',+// icon: <RightIcon />,+// children: [+// {+// label: <ImageList config={this.props.config} type="data"></ImageList>,+// className: 'univer-image-li',+// },+// ],+// },+// {+// locale: 'conditionalformat.colorGradation',+// icon: <RightIcon />,+// children: [+// {+// label: <ImageList config={this.props.config} type="color"></ImageList>,+// className: 'univer-image-li',+// },+// ],+// },+// {+// locale: 'conditionalformat.icons',+// onClick: this.showIconModal,+// },+// {+// locale: 'conditionalformat.newRule',+// onClick: this.showRuleModal,+// border: true,+// },+// {+// locale: 'conditionalformat.deleteRule',+// icon: <RightIcon />,+// children: [+// {+// locale: 'conditionalformat.deleteSheetRule',+// },+// ],+// },+// {+// locale: 'conditionalformat.manageRules',+// onClick: this.showManageModal,+// },+// ],+// },+// modalData: [+// {+// show: false,+// group: [+// {+// locale: 'button.confirm',+// type: 'primary',+// },+// {+// locale: 'button.cancel',+// },+// ],+// children: <ConditionContent config={this.props.config} type="text" genre="greater" />,+// onCancel: () => {+// this.showModal(0, false);+// },+// },+// {+// locale: 'conditionalformat.icons',+// show: false,+// group: [+// {+// locale: 'button.cancel',+// },+// ],+// children: <IconContent config={this.props.config} />,+// onCancel: () => {+// this.showModal(1, false);+// },+// },+// {+// locale: 'conditionalformat.newFormatRule',+// show: false,+// group: [+// {+// locale: 'button.confirm',+// type: 'primary',+// },+// {+// locale: 'button.cancel',+// },+// ],+// children: <RuleContent config={this.props.config} />,+// onCancel: () => {+// this.showModal(2, false);+// },+// },+// {+// locale: 'conditionalformat.conditionalformatManageRules',+// show: false,+// group: [+// {+// locale: 'button.confirm',+// type: 'primary',+// },+// {+// locale: 'button.cancel',+// },+// ],+// children: <RuleManage config={this.props.config} />,+// onCancel: () => {+// this.showModal(3, false);+// },+// },+// ],+// };+// }- /**- * init- */- componentWillMount() {- this.setLocale();+// /**+// * init+// */+// componentWillMount() {+// this.setLocale();- // subscribe Locale change event+// // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }+// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }- /**- * destory- */- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }+// /**+// * destory+// */+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }- /**- * set text by config setting and Locale message- */- setLocale() {- const locale = this._context.getLocale();- this.setState((prevState: IState) => {- let item = prevState.conditionalFormat;- // set current Locale string for tooltip- item.tooltip = locale.get(`${item.locale}`);+// /**+// * set text by config setting and Locale message+// */+// setLocale() {+// const locale = this._context.getLocale();+// this.setState((prevState: IState) => {+// let item = prevState.conditionalFormat;+// // set current Locale string for tooltip+// item.tooltip = locale.get(`${item.locale}`);- // set current Locale string for select- item.children?.forEach((ele: any) => {- if (ele.locale) {- ele.label = locale.get(`${ele.locale}`);- }- if (ele.children) {- ele.children.forEach((node: any) => {- if (node.locale) {- node.label = locale.get(node.locale);- }- if (node.iconName) {- node.icon = locale.get(node.iconName);- }- });- }- });- item.label = typeof item.label === 'object' ? item.label : item.children![0].label;- // set current Locale for modal- let { modalData } = prevState;- modalData.forEach((ele) => {- ele.title = ele.locale ? locale.get(ele.locale) : '';- if (ele.group && ele.group.length) {- ele.group.forEach((node) => {- node.label = locale.get(node.locale!);- });- }- });+// // set current Locale string for select+// item.children?.forEach((ele: any) => {+// if (ele.locale) {+// ele.label = locale.get(`${ele.locale}`);+// }+// if (ele.children) {+// ele.children.forEach((node: any) => {+// if (node.locale) {+// node.label = locale.get(node.locale);+// }+// if (node.iconName) {+// node.icon = locale.get(node.iconName);+// }+// });+// }+// });+// item.label = typeof item.label === 'object' ? item.label : item.children![0].label;+// // set current Locale for modal+// let { modalData } = prevState;+// modalData.forEach((ele) => {+// ele.title = ele.locale ? locale.get(ele.locale) : '';+// if (ele.group && ele.group.length) {+// ele.group.forEach((node) => {+// node.label = locale.get(node.locale!);+// });+// }+// });- return {- conditionalFormat: item,- modalData,- };- });- }+// return {+// conditionalFormat: item,+// modalData,+// };+// });+// }- // showmodal- showModal = (index: number, isShow: boolean) => {- this.setState((prevState) => {- let { modalData } = prevState;+// // showmodal+// showModal = (index: number, isShow: boolean) => {+// this.setState((prevState) => {+// let { modalData } = prevState;- modalData[index].show = isShow;- return {- modalData,- };- });- };+// modalData[index].show = isShow;+// return {+// modalData,+// };+// });+// };- // show different type of modal- showContentModal = (...a: any[]) => {- const item = a[2].item;- this.setState((prevState) => {- let { modalData } = prevState;- modalData[0].children = <ConditionContent config={this.props.config} type={item.type} genre={item.genre} />;- modalData[0].show = true;+// // show different type of modal+// showContentModal = (...a: any[]) => {+// const item = a[2].item;+// this.setState((prevState) => {+// let { modalData } = prevState;+// modalData[0].children = <ConditionContent config={this.props.config} type={item.type} genre={item.genre} />;+// modalData[0].show = true;- return {- modalData,- };- });- };+// return {+// modalData,+// };+// });+// };- showRuleModal = () => {- this.showModal(2, true);- };+// showRuleModal = () => {+// this.showModal(2, true);+// };- showManageModal = () => {- this.showModal(3, true);- };+// showManageModal = () => {+// this.showModal(3, true);+// };- showIconModal = () => {- this.showModal(1, true);- };+// showIconModal = () => {+// this.showModal(1, true);+// };- /**- * Render the component's HTML- *- * @returns {void}- */- render(props: IProps, state: IState) {- const Select = this.Render.renderFunction('Select');- const Modal = this.Render.renderFunction('Modal');- const { conditionalFormat, modalData } = state;- // Set Provider for entire Container- return (- <>- <Select- tooltip={conditionalFormat.tooltip}- key={conditionalFormat.locale}- children={conditionalFormat.children as BaseSelectProps[]}- label={conditionalFormat.label}- icon={conditionalFormat.icon}- />- {modalData.map((item) => {- if (!item.show) return;- return (- <Modal title={item.title} visible={item.show} group={item.group} onCancel={item.onCancel}>- {item.children}- </Modal>- );- })}- </>- );- }-}+// /**+// * Render the component's HTML+// *+// * @returns {void}+// */+// render(props: IProps, state: IState) {+// const Select = this.Render.renderFunction('Select');+// const Modal = this.Render.renderFunction('Modal');+// const { conditionalFormat, modalData } = state;+// // Set Provider for entire Container+// return (+// <>+// <Select+// tooltip={conditionalFormat.tooltip}+// key={conditionalFormat.locale}+// children={conditionalFormat.children as BaseSelectProps[]}+// label={conditionalFormat.label}+// icon={conditionalFormat.icon}+// />+// {modalData.map((item) => {+// if (!item.show) return;+// return (+// <Modal title={item.title} visible={item.show} group={item.group} onCancel={item.onCancel}>+// {item.children}+// </Modal>+// );+// })}+// </>+// );+// }+// }diff --git a/packages/sheets-plugin-conditional-format/src/UI/ImageList.tsx b/packages/sheets-plugin-conditional-format/src/UI/ImageList.tsxindex 4f36a9ac81..d318a3e246 100644--- a/packages/sheets-plugin-conditional-format/src/UI/ImageList.tsx+++ b/packages/sheets-plugin-conditional-format/src/UI/ImageList.tsx@@ -1,232 +1,232 @@-import { Component } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import CFcolorGradation from '../Assets/CFcolorGradation.png';-import CFdataBar from '../Assets/CFdataBar.png';-import styles from './index.module.less';+// import { Component } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import CFcolorGradation from '../Assets/CFcolorGradation.png';+// import CFdataBar from '../Assets/CFdataBar.png';+// import styles from './index.module.less';-type ImageListProps = {- config?: any;- type: string;-};-type ImageListState = {- dataList: LabelProps[];- colorList: LabelProps[];- list: LabelProps[];- url: string;-};-type LabelProps = {- title: Record<string, string>;- style: string;-};+// type ImageListProps = {+// config?: any;+// type: string;+// };+// type ImageListState = {+// dataList: LabelProps[];+// colorList: LabelProps[];+// list: LabelProps[];+// url: string;+// };+// type LabelProps = {+// title: Record<string, string>;+// style: string;+// };-export class ImageList extends Component<ImageListProps, ImageListState> {- private _localeObserver: Nullable<Observer<Workbook>>;+// export class ImageList extends Component<ImageListProps, ImageListState> {+// private _localeObserver: Nullable<Observer<Workbook>>;- state = {- dataList: [- {- title: {- name: 'conditionalformat.gradientDataBar_1',- },- style: '0 0',- },- {- title: {- name: 'conditionalformat.gradientDataBar_2',- },- style: '-38px 0',- },- {- title: {- name: 'conditionalformat.gradientDataBar_3',- },- style: '-76px 0',- },- {- title: {- name: 'conditionalformat.gradientDataBar_4',- },- style: '0 -36px',- },- {- title: {- name: 'conditionalformat.gradientDataBar_5',- },- style: '-38px -36px',- },- {- title: {- name: 'conditionalformat.gradientDataBar_6',- },- style: '-75px -36px',- },- {- title: {- name: 'conditionalformat.gradientDataBar_7',- },- style: '0 -72px',- },- {- title: {- name: 'conditionalformat.gradientDataBar_8',- },- style: '-38px -72px',- },- {- title: {- name: 'conditionalformat.gradientDataBar_9',- },- style: '-76px -72px',- },- {- title: {- name: 'conditionalformat.gradientDataBar_10',- },- style: '0 -108px',- },- {- title: {- name: 'conditionalformat.gradientDataBar_11',- },- style: '-38px -108px',- },- {- title: {- name: 'conditionalformat.gradientDataBar_12',- },- style: '-76px -108px',- },- ],- colorList: [- {- title: {- name: 'colorGradation_1',- },- style: '0 0',- },- {- title: {- name: 'colorGradation_2',- },- style: '-38px 0',- },- {- title: {- name: 'colorGradation_3',- },- style: '-76px 0',- },- {- title: {- name: 'colorGradation_4',- },- style: '-114px 0',- },- {- title: {- name: 'colorGradation_5',- },- style: '0 -36px',- },- {- title: {- name: 'colorGradation_6',- },- style: '-38px -36px',- },- {- title: {- name: 'colorGradation_7',- },- style: '-76px -36px',- },- {- title: {- name: 'colorGradation_8',- },- style: '-114px -36px',- },- {- title: {- name: 'colorGradation_9',- },- style: '0 -72px',- },- {- title: {- name: 'colorGradation_10',- },- style: '-38px -72px',- },- {- title: {- name: 'colorGradation_11',- },- style: '-76px -72px',- },- {- title: {- name: 'colorGradation_12',- },- style: '-114px -72px',- },- ],- list: [],- url: '',- };+// state = {+// dataList: [+// {+// title: {+// name: 'conditionalformat.gradientDataBar_1',+// },+// style: '0 0',+// },+// {+// title: {+// name: 'conditionalformat.gradientDataBar_2',+// },+// style: '-38px 0',+// },+// {+// title: {+// name: 'conditionalformat.gradientDataBar_3',+// },+// style: '-76px 0',+// },+// {+// title: {+// name: 'conditionalformat.gradientDataBar_4',+// },+// style: '0 -36px',+// },+// {+// title: {+// name: 'conditionalformat.gradientDataBar_5',+// },+// style: '-38px -36px',+// },+// {+// title: {+// name: 'conditionalformat.gradientDataBar_6',+// },+// style: '-75px -36px',+// },+// {+// title: {+// name: 'conditionalformat.gradientDataBar_7',+// },+// style: '0 -72px',+// },+// {+// title: {+// name: 'conditionalformat.gradientDataBar_8',+// },+// style: '-38px -72px',+// },+// {+// title: {+// name: 'conditionalformat.gradientDataBar_9',+// },+// style: '-76px -72px',+// },+// {+// title: {+// name: 'conditionalformat.gradientDataBar_10',+// },+// style: '0 -108px',+// },+// {+// title: {+// name: 'conditionalformat.gradientDataBar_11',+// },+// style: '-38px -108px',+// },+// {+// title: {+// name: 'conditionalformat.gradientDataBar_12',+// },+// style: '-76px -108px',+// },+// ],+// colorList: [+// {+// title: {+// name: 'colorGradation_1',+// },+// style: '0 0',+// },+// {+// title: {+// name: 'colorGradation_2',+// },+// style: '-38px 0',+// },+// {+// title: {+// name: 'colorGradation_3',+// },+// style: '-76px 0',+// },+// {+// title: {+// name: 'colorGradation_4',+// },+// style: '-114px 0',+// },+// {+// title: {+// name: 'colorGradation_5',+// },+// style: '0 -36px',+// },+// {+// title: {+// name: 'colorGradation_6',+// },+// style: '-38px -36px',+// },+// {+// title: {+// name: 'colorGradation_7',+// },+// style: '-76px -36px',+// },+// {+// title: {+// name: 'colorGradation_8',+// },+// style: '-114px -36px',+// },+// {+// title: {+// name: 'colorGradation_9',+// },+// style: '0 -72px',+// },+// {+// title: {+// name: 'colorGradation_10',+// },+// style: '-38px -72px',+// },+// {+// title: {+// name: 'colorGradation_11',+// },+// style: '-76px -72px',+// },+// {+// title: {+// name: 'colorGradation_12',+// },+// style: '-114px -72px',+// },+// ],+// list: [],+// url: '',+// };- setLocale() {- // setLocale for diffrent type of modal- const locale = this._context.getLocale();+// setLocale() {+// // setLocale for diffrent type of modal+// const locale = this._context.getLocale();- this.setState((prevState) => {- let { dataList, colorList, list, url } = prevState;- const { type } = this.props;- dataList.forEach((item) => {- item.title.label = locale.get(item.title.name);- });- colorList.forEach((item) => {- item.title.label = locale.get(item.title.name);- });+// this.setState((prevState) => {+// let { dataList, colorList, list, url } = prevState;+// const { type } = this.props;+// dataList.forEach((item) => {+// item.title.label = locale.get(item.title.name);+// });+// colorList.forEach((item) => {+// item.title.label = locale.get(item.title.name);+// });- if (type === 'data') {- list = dataList;- url = CFdataBar;- } else {- list = colorList;- url = CFcolorGradation;- }+// if (type === 'data') {+// list = dataList;+// url = CFdataBar;+// } else {+// list = colorList;+// url = CFcolorGradation;+// }- return { list, url };- });- }+// return { list, url };+// });+// }- componentWillMount() {- this.setLocale();+// componentWillMount() {+// this.setLocale();- // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }+// // subscribe Locale change event+// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }- render(props: ImageListProps, state: ImageListState) {- const { list, url } = state;- return (- <div className={styles.imageContent}>- {list.map((item) => (- <div>- <div title={item.title.label} style={{ backgroundImage: `url(${url})`, backgroundPosition: item.style }}></div>- </div>- ))}- </div>- );- }-}+// render(props: ImageListProps, state: ImageListState) {+// const { list, url } = state;+// return (+// <div className={styles.imageContent}>+// {list.map((item) => (+// <div>+// <div title={item.title.label} style={{ backgroundImage: `url(${url})`, backgroundPosition: item.style }}></div>+// </div>+// ))}+// </div>+// );+// }+// }diff --git a/packages/sheets-plugin-conditional-format/src/UI/RuleContent.tsx b/packages/sheets-plugin-conditional-format/src/UI/RuleContent.tsxindex 98ffdd16c8..d79caff058 100644--- a/packages/sheets-plugin-conditional-format/src/UI/RuleContent.tsx+++ b/packages/sheets-plugin-conditional-format/src/UI/RuleContent.tsx@@ -1,687 +1,687 @@-import { BaseComponentRender, BaseComponentSheet, Component, joinClassNames } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { SheetPlugin } from '@univerjs/base-sheets';-import styles from './index.module.less';--type RuleContentProps = {- config?: any;-};-type RuleContentState = {- ruleOption: LabelProps[];- title: Record<string, LabelProps>;- type: string;-};-type LabelProps = {- name?: string;- label?: string;- value?: string;- active?: boolean;- type?: string;-};--export class RuleContent extends Component<RuleContentProps, RuleContentState> {- private _localeObserver: Nullable<Observer<Workbook>>;-- Render: BaseComponentRender;-- initialize() {- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();-- this.state = {- title: {- chooseTitle: {- name: 'conditionalformat.chooseRuleType',- },- editTitle: {- name: 'conditionalformat.editRuleDescription',- },- },- ruleOption: [- {- name: 'conditionalformat.ruleTypeItem1',- type: 'all',- active: true,- },- {- name: 'conditionalformat.ruleTypeItem2',- type: 'contain',- },- {- name: 'conditionalformat.ruleTypeItem3',- type: 'rank',- },- {- name: 'conditionalformat.ruleTypeItem4',- type: 'average',- },- {- name: 'conditionalformat.ruleTypeItem5',- type: 'duplicate',- },- {- name: 'conditionalformat.ruleTypeItem6',- type: 'formula',- },- ],- type: 'all',- };- }-- setLocale() {- // setLocale for diffrent type of modal- const locale = this._context.getLocale();-- function getLabel(obj: object) {- Object.keys(obj).forEach((item) => {- obj[item].label = locale.get(obj[item].name);- });- }-- this.setState((prevState) => {- const { ruleOption, title } = prevState;- ruleOption.forEach((item) => {- item.label = locale.get(item.name || '');- });-- getLabel(title);-- return { ruleOption, title };- });- }-- componentWillMount() {- this.setLocale();-- // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }-- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }-- setValue = (value: object, fn?: () => void) => {- this.setState(- (prevState) => ({- ...value,- }),- fn- );- };-- // choose selected rule- handleActive = (index: number) => {- let { ruleOption, type } = this.state;- ruleOption.forEach((item) => {- item.active = false;- });- ruleOption[index].active = true;- type = ruleOption[index].type!;-- this.setValue({- ruleOption,- type,- });- };-- render(props: RuleContentProps, state: RuleContentState) {- const RightIcon = this.Render.renderFunction('RightIcon');- const { ruleOption, title, type } = state;- const { config } = props;- return (- <div className={styles.ruleContent}>- <div>- <p className={styles.ruleTitle}>{title.chooseTitle.label}:</p>- <div className={styles.ruleBox}>- {ruleOption.map((item, index) => (- <div className={joinClassNames(styles.ruleItem, { [`${styles.ruleItem}-active`]: item.active })} onClick={() => this.handleActive(index)}>- <RightIcon /> <span>{item.label}</span>- </div>- ))}- </div>- </div>- <div>- <p className={styles.ruleTitle}>{title.editTitle.label}:</p>- <div className={styles.ruleBox}>- <RuleEditContent type={type} config={config}></RuleEditContent>- </div>- </div>- </div>- );- }-}--type RuleEditProps = {- type: string;- config: any;-};-type RuleEditState = {- all: Record<string, LabelProps>;- formatStyle: LabelProps[];- formatType: string;- containType: string;- fillType: LabelProps[];- fillType1: LabelProps[];- setting: Record<string, LabelProps>;- contain: Record<string, LabelProps>;- rank: Record<string, LabelProps>;- cellOption: LabelProps[];- mathOption: LabelProps[];- textOptions: LabelProps[];- rankOption: LabelProps[];- average: Record<string, LabelProps>;- averageOption: LabelProps[];- duplicate: Record<string, LabelProps>;- duplicateOption: LabelProps[];- formula: Record<string, LabelProps>;-};--// edit rule content-class RuleEditContent extends Component<RuleEditProps, RuleEditState> {- private _localeObserver: Nullable<Observer<Workbook>>;-- Render: BaseComponentRender;-- initialize() {- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();-- this.state = {- all: {- title: {- name: 'conditionalformat.ruleTypeItem1',- },- formatStyle: {- name: 'conditionalformat.formatStyle',- },- fillType: {- name: 'conditionalformat.fillType',- label: '',- },- color: {- name: 'conditionalformat.color',- label: '',- },- max: {- name: 'conditionalformat.maxValue',- label: '',- },- min: {- name: 'conditionalformat.minValue',- label: '',- },- },- formatStyle: [- {- name: 'conditionalformat.dataBar',- },- {- name: 'conditionalformat.colorGradation',- },- {- name: 'conditionalformat.icons',- },- ],- formatType: 'dataBar',- fillType: [- {- name: 'conditionalformat.gradient',- label: '',- value: '',- },- {- name: 'conditionalformat.solid',- },- ],- fillType1: [- {- name: 'conditionalformat.twocolor',- label: '',- value: '',- },- {- name: 'conditionalformat.tricolor',- },- ],- setting: {- setAs: {- name: 'conditionalformat.setFormat',- },- textColor: {- name: 'conditionalformat.textColor',- },- cellColor: {- name: 'conditionalformat.cellColor',- },- },- contain: {- title: {- name: 'conditionalformat.ruleTypeItem2_title',- label: '',- },- },- containType: 'cellValue',- cellOption: [- {- name: 'conditionalformat.cellValue',- label: '',- value: '',- },- {- name: 'conditionalformat.specificText',- },- {- name: 'conditionalformat.occurrence.text',- },- ],- mathOption: [- {- name: 'conditionalformat.greaterThan.text',- label: '',- value: '',- },- {- name: 'conditionalformat.lessThan.text',- },- {- name: 'conditionalformat.between.text',- },- {- name: 'conditionalformat.equal.text',- },- ],- textOptions: [- {- name: 'conditionalformat.contain',- label: '',- value: '',- },- ],- rank: {- title: { name: 'conditionalformat.ruleTypeItem3_title', label: '' },- subtitle: {- name: 'conditionalformat.selectRange_percent',- label: '',- },- },- rankOption: [- {- name: 'conditionalformat.top',- label: '',- value: '',- },- {- name: 'conditionalformat.last',- },- ],- average: {- title: {- name: 'conditionalformat.ruleTypeItem4_title',- label: '',- },- subtitle: {- name: 'conditionalformat.selectRange_average',- label: '',- },- },- averageOption: [- {- name: 'conditionalformat.above',- label: '',- value: '',- },- {- name: 'conditionalformat.below',- },- ],- duplicate: {- title: {- name: 'conditionalformat.all',- label: '',- },- subtitle: {- name: 'conditionalformat.selectRange_value',- label: '',- },- },- duplicateOption: [- {- name: 'conditionalformat.duplicateValue.text',- label: '',- value: '',- },- {- name: 'conditionalformat.uniqueValue',- },- ],- formula: {- title: {- name: 'conditionalformat.ruleTypeItem2_title',- label: '',- },- },- };- }-- setLocale() {- // setLocale for diffrent type of modal- const locale = this._context.getLocale();- const { type } = this.props;- // set Locale for object- function getLabel(obj: object) {- Object.keys(obj).forEach((item) => {- obj[item].label = locale.get(obj[item].name);- });- }- // set Locale for array- function getArrayLabel(arr: LabelProps[]) {- return arr.map((item) => {- item.label = locale.get(item.name || '');- return item;- });- }- this.setState((prevState) => {- let {- all,- formatStyle,- fillType,- fillType1,- setting,- cellOption,- mathOption,- textOptions,- rankOption,- rank,- contain,- average,- averageOption,- duplicate,- duplicateOption,- formula,- } = prevState;- getLabel(all);- getLabel(setting);- getLabel(rank);- getLabel(contain);- getLabel(average);- getLabel(duplicate);- getLabel(formula);- formatStyle = getArrayLabel(formatStyle);- fillType = getArrayLabel(fillType);- fillType1 = getArrayLabel(fillType1);- cellOption = getArrayLabel(cellOption);- mathOption = getArrayLabel(mathOption);- textOptions = getArrayLabel(textOptions);- rankOption = getArrayLabel(rankOption);- averageOption = getArrayLabel(averageOption);- duplicateOption = getArrayLabel(duplicateOption);-- return {- all,- formatStyle,- fillType,- fillType1,- setting,- cellOption,- mathOption,- textOptions,- rank,- contain,- rankOption,- average,- averageOption,- duplicate,- duplicateOption,- formula,- };- });- }-- componentWillMount() {- this.setLocale();-- // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }-- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }-- setValue = (value: object, fn?: () => void) => {- this.setState(- (prevState) => ({- ...value,- }),- fn- );- };-- // render content for type of all- getAllTypeContent = () => {- const { formatType, fillType, all, fillType1 } = this.state;-- if (formatType === 'dataBar') {- return (- <>- <div className={styles.ruleEditItem}>- <span>{all.fillType.label}:</span>- <select>- {fillType.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- </div>- <div className={styles.ruleEditItem}>- <span>{all.color.label}:</span>- </div>- </>- );- }- if (formatType === 'colorGradation') {- return (- <>- <div>- <span>{all.fillType.label}</span>- <select>- {fillType1.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- </div>- <div className={styles.ruleEditItem}>- <span>{all.color.label}:</span>- </div>- <div className={styles.ruleEditItem}>- <span>{all.color.label}:</span>- </div>- </>- );- }- if (formatType === 'icons') {- return (- <>- <div>- <span>{all.fillType.label}</span>- </div>- </>- );- }- };-- // render content for different type- getEditContent = () => {- const { type } = this.props;- if (type === 'contain') {- const CellRangeModal = this.Render.renderFunction('CellRangeModal');-- const { cellOption, mathOption, textOptions, contain, containType } = this.state;- return (- <>- <p className={styles.ruleEditTitle}>{contain.title.label}</p>- <div className={styles.ruleEditContent}>- <select>- {cellOption.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- {containType === 'cellValue' ? (- <>- <select>- {mathOption.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- <CellRangeModal></CellRangeModal>- </>- ) : (- ''- )}- {containType === 'specificText' ? (- <>- <select>- {textOptions.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- <CellRangeModal></CellRangeModal>- </>- ) : (- ''- )}- {containType === 'occurrence' ? (- <>- <input type="date" />- </>- ) : (- ''- )}- </div>- </>- );- }- if (type === 'rank') {- const { rankOption, rank } = this.state;- const Checkbox = this.Render.renderFunction('Checkbox');-- const Input = this.Render.renderFunction('Input');- return (- <>- <p className={styles.ruleEditTitle}>{rank.title.label}</p>- <div className={styles.ruleEditContent}>- <select>- {rankOption.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- <Input />- <Checkbox>{rank.subtitle.label}</Checkbox>- </div>- </>- );- }- if (type === 'average') {- const { averageOption, average } = this.state;- return (- <>- <p className={styles.ruleEditTitle}>{average.title.label}</p>- <div className={styles.ruleEditContent}>- <select>- {averageOption.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- <span>{average.subtitle.label}</span>- </div>- </>- );- }- if (type === 'duplicate') {- const { duplicateOption, duplicate } = this.state;- return (- <>- <p className={styles.ruleEditTitle}>{duplicate.title.label}</p>- <div className={styles.ruleEditContent}>- <select>- {duplicateOption.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- <span>{duplicate.subtitle.label}</span>- </div>- </>- );- }- if (type === 'formula') {- const { formula } = this.state;- const CellRangeModal = this.Render.renderFunction('CellRangeModal');-- return (- <>- <p className={styles.ruleEditTitle}>{formula.title.label}</p>- <div className={styles.ruleEditContent}>- <CellRangeModal></CellRangeModal>- </div>- </>- );- }- };-- pickTextColor = () => {};-- pickCellColor = () => {};-- cancelColor = () => {};-- render(props: RuleEditProps, state: RuleEditState) {- const ColorPicker = this.Render.renderFunction('ColorPicker');- const Checkbox = this.Render.renderFunction('Checkbox');- const { type } = props;- const { all, formatStyle, setting } = state;-- if (type === 'all') {- return (- <div className={styles.ruleEdit}>- <p className={styles.ruleEditTitle}>{all.title.label}</p>- <div className={styles.ruleEditItem}>- <span>{all.formatStyle.label}:</span>- <select>- {formatStyle.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- </div>- {this.getAllTypeContent()}- </div>- );- }-- return (- <div className={styles.ruleEdit}>- <div>{this.getEditContent()}</div>- <p className={styles.ruleEditTitle}>{setting.setAs.label}</p>- <div className={styles.colorBox}>- <div className={styles.colorItem}>- <Checkbox>{setting.textColor.label}</Checkbox>- <ColorPicker color="#9c0006" onClick={this.pickTextColor} onCancel={this.cancelColor}></ColorPicker>- </div>- <div className={styles.colorItem}>- <Checkbox>{setting.cellColor.label}</Checkbox>- <ColorPicker color="#ffc7ce" onClick={this.pickCellColor} onCancel={this.cancelColor}></ColorPicker>- </div>- </div>- </div>- );- }-}+// import { BaseComponentRender, BaseComponentSheet, Component, joinClassNames } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { SheetPlugin } from '@univerjs/base-sheets';+// import styles from './index.module.less';++// type RuleContentProps = {+// config?: any;+// };+// type RuleContentState = {+// ruleOption: LabelProps[];+// title: Record<string, LabelProps>;+// type: string;+// };+// type LabelProps = {+// name?: string;+// label?: string;+// value?: string;+// active?: boolean;+// type?: string;+// };++// export class RuleContent extends Component<RuleContentProps, RuleContentState> {+// private _localeObserver: Nullable<Observer<Workbook>>;++// Render: BaseComponentRender;++// initialize() {+// const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();++// this.state = {+// title: {+// chooseTitle: {+// name: 'conditionalformat.chooseRuleType',+// },+// editTitle: {+// name: 'conditionalformat.editRuleDescription',+// },+// },+// ruleOption: [+// {+// name: 'conditionalformat.ruleTypeItem1',+// type: 'all',+// active: true,+// },+// {+// name: 'conditionalformat.ruleTypeItem2',+// type: 'contain',+// },+// {+// name: 'conditionalformat.ruleTypeItem3',+// type: 'rank',+// },+// {+// name: 'conditionalformat.ruleTypeItem4',+// type: 'average',+// },+// {+// name: 'conditionalformat.ruleTypeItem5',+// type: 'duplicate',+// },+// {+// name: 'conditionalformat.ruleTypeItem6',+// type: 'formula',+// },+// ],+// type: 'all',+// };+// }++// setLocale() {+// // setLocale for diffrent type of modal+// const locale = this._context.getLocale();++// function getLabel(obj: object) {+// Object.keys(obj).forEach((item) => {+// obj[item].label = locale.get(obj[item].name);+// });+// }++// this.setState((prevState) => {+// const { ruleOption, title } = prevState;+// ruleOption.forEach((item) => {+// item.label = locale.get(item.name || '');+// });++// getLabel(title);++// return { ruleOption, title };+// });+// }++// componentWillMount() {+// this.setLocale();++// // subscribe Locale change event+// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }++// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }++// setValue = (value: object, fn?: () => void) => {+// this.setState(+// (prevState) => ({+// ...value,+// }),+// fn+// );+// };++// // choose selected rule+// handleActive = (index: number) => {+// let { ruleOption, type } = this.state;+// ruleOption.forEach((item) => {+// item.active = false;+// });+// ruleOption[index].active = true;+// type = ruleOption[index].type!;++// this.setValue({+// ruleOption,+// type,+// });+// };++// render(props: RuleContentProps, state: RuleContentState) {+// const RightIcon = this.Render.renderFunction('RightIcon');+// const { ruleOption, title, type } = state;+// const { config } = props;+// return (+// <div className={styles.ruleContent}>+// <div>+// <p className={styles.ruleTitle}>{title.chooseTitle.label}:</p>+// <div className={styles.ruleBox}>+// {ruleOption.map((item, index) => (+// <div className={joinClassNames(styles.ruleItem, { [`${styles.ruleItem}-active`]: item.active })} onClick={() => this.handleActive(index)}>+// <RightIcon /> <span>{item.label}</span>+// </div>+// ))}+// </div>+// </div>+// <div>+// <p className={styles.ruleTitle}>{title.editTitle.label}:</p>+// <div className={styles.ruleBox}>+// <RuleEditContent type={type} config={config}></RuleEditContent>+// </div>+// </div>+// </div>+// );+// }+// }++// type RuleEditProps = {+// type: string;+// config: any;+// };+// type RuleEditState = {+// all: Record<string, LabelProps>;+// formatStyle: LabelProps[];+// formatType: string;+// containType: string;+// fillType: LabelProps[];+// fillType1: LabelProps[];+// setting: Record<string, LabelProps>;+// contain: Record<string, LabelProps>;+// rank: Record<string, LabelProps>;+// cellOption: LabelProps[];+// mathOption: LabelProps[];+// textOptions: LabelProps[];+// rankOption: LabelProps[];+// average: Record<string, LabelProps>;+// averageOption: LabelProps[];+// duplicate: Record<string, LabelProps>;+// duplicateOption: LabelProps[];+// formula: Record<string, LabelProps>;+// };++// // edit rule content+// class RuleEditContent extends Component<RuleEditProps, RuleEditState> {+// private _localeObserver: Nullable<Observer<Workbook>>;++// Render: BaseComponentRender;++// initialize() {+// const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();++// this.state = {+// all: {+// title: {+// name: 'conditionalformat.ruleTypeItem1',+// },+// formatStyle: {+// name: 'conditionalformat.formatStyle',+// },+// fillType: {+// name: 'conditionalformat.fillType',+// label: '',+// },+// color: {+// name: 'conditionalformat.color',+// label: '',+// },+// max: {+// name: 'conditionalformat.maxValue',+// label: '',+// },+// min: {+// name: 'conditionalformat.minValue',+// label: '',+// },+// },+// formatStyle: [+// {+// name: 'conditionalformat.dataBar',+// },+// {+// name: 'conditionalformat.colorGradation',+// },+// {+// name: 'conditionalformat.icons',+// },+// ],+// formatType: 'dataBar',+// fillType: [+// {+// name: 'conditionalformat.gradient',+// label: '',+// value: '',+// },+// {+// name: 'conditionalformat.solid',+// },+// ],+// fillType1: [+// {+// name: 'conditionalformat.twocolor',+// label: '',+// value: '',+// },+// {+// name: 'conditionalformat.tricolor',+// },+// ],+// setting: {+// setAs: {+// name: 'conditionalformat.setFormat',+// },+// textColor: {+// name: 'conditionalformat.textColor',+// },+// cellColor: {+// name: 'conditionalformat.cellColor',+// },+// },+// contain: {+// title: {+// name: 'conditionalformat.ruleTypeItem2_title',+// label: '',+// },+// },+// containType: 'cellValue',+// cellOption: [+// {+// name: 'conditionalformat.cellValue',+// label: '',+// value: '',+// },+// {+// name: 'conditionalformat.specificText',+// },+// {+// name: 'conditionalformat.occurrence.text',+// },+// ],+// mathOption: [+// {+// name: 'conditionalformat.greaterThan.text',+// label: '',+// value: '',+// },+// {+// name: 'conditionalformat.lessThan.text',+// },+// {+// name: 'conditionalformat.between.text',+// },+// {+// name: 'conditionalformat.equal.text',+// },+// ],+// textOptions: [+// {+// name: 'conditionalformat.contain',+// label: '',+// value: '',+// },+// ],+// rank: {+// title: { name: 'conditionalformat.ruleTypeItem3_title', label: '' },+// subtitle: {+// name: 'conditionalformat.selectRange_percent',+// label: '',+// },+// },+// rankOption: [+// {+// name: 'conditionalformat.top',+// label: '',+// value: '',+// },+// {+// name: 'conditionalformat.last',+// },+// ],+// average: {+// title: {+// name: 'conditionalformat.ruleTypeItem4_title',+// label: '',+// },+// subtitle: {+// name: 'conditionalformat.selectRange_average',+// label: '',+// },+// },+// averageOption: [+// {+// name: 'conditionalformat.above',+// label: '',+// value: '',+// },+// {+// name: 'conditionalformat.below',+// },+// ],+// duplicate: {+// title: {+// name: 'conditionalformat.all',+// label: '',+// },+// subtitle: {+// name: 'conditionalformat.selectRange_value',+// label: '',+// },+// },+// duplicateOption: [+// {+// name: 'conditionalformat.duplicateValue.text',+// label: '',+// value: '',+// },+// {+// name: 'conditionalformat.uniqueValue',+// },+// ],+// formula: {+// title: {+// name: 'conditionalformat.ruleTypeItem2_title',+// label: '',+// },+// },+// };+// }++// setLocale() {+// // setLocale for diffrent type of modal+// const locale = this._context.getLocale();+// const { type } = this.props;+// // set Locale for object+// function getLabel(obj: object) {+// Object.keys(obj).forEach((item) => {+// obj[item].label = locale.get(obj[item].name);+// });+// }+// // set Locale for array+// function getArrayLabel(arr: LabelProps[]) {+// return arr.map((item) => {+// item.label = locale.get(item.name || '');+// return item;+// });+// }+// this.setState((prevState) => {+// let {+// all,+// formatStyle,+// fillType,+// fillType1,+// setting,+// cellOption,+// mathOption,+// textOptions,+// rankOption,+// rank,+// contain,+// average,+// averageOption,+// duplicate,+// duplicateOption,+// formula,+// } = prevState;+// getLabel(all);+// getLabel(setting);+// getLabel(rank);+// getLabel(contain);+// getLabel(average);+// getLabel(duplicate);+// getLabel(formula);+// formatStyle = getArrayLabel(formatStyle);+// fillType = getArrayLabel(fillType);+// fillType1 = getArrayLabel(fillType1);+// cellOption = getArrayLabel(cellOption);+// mathOption = getArrayLabel(mathOption);+// textOptions = getArrayLabel(textOptions);+// rankOption = getArrayLabel(rankOption);+// averageOption = getArrayLabel(averageOption);+// duplicateOption = getArrayLabel(duplicateOption);++// return {+// all,+// formatStyle,+// fillType,+// fillType1,+// setting,+// cellOption,+// mathOption,+// textOptions,+// rank,+// contain,+// rankOption,+// average,+// averageOption,+// duplicate,+// duplicateOption,+// formula,+// };+// });+// }++// componentWillMount() {+// this.setLocale();++// // subscribe Locale change event+// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }++// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }++// setValue = (value: object, fn?: () => void) => {+// this.setState(+// (prevState) => ({+// ...value,+// }),+// fn+// );+// };++// // render content for type of all+// getAllTypeContent = () => {+// const { formatType, fillType, all, fillType1 } = this.state;++// if (formatType === 'dataBar') {+// return (+// <>+// <div className={styles.ruleEditItem}>+// <span>{all.fillType.label}:</span>+// <select>+// {fillType.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// </div>+// <div className={styles.ruleEditItem}>+// <span>{all.color.label}:</span>+// </div>+// </>+// );+// }+// if (formatType === 'colorGradation') {+// return (+// <>+// <div>+// <span>{all.fillType.label}</span>+// <select>+// {fillType1.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// </div>+// <div className={styles.ruleEditItem}>+// <span>{all.color.label}:</span>+// </div>+// <div className={styles.ruleEditItem}>+// <span>{all.color.label}:</span>+// </div>+// </>+// );+// }+// if (formatType === 'icons') {+// return (+// <>+// <div>+// <span>{all.fillType.label}</span>+// </div>+// </>+// );+// }+// };++// // render content for different type+// getEditContent = () => {+// const { type } = this.props;+// if (type === 'contain') {+// const CellRangeModal = this.Render.renderFunction('CellRangeModal');++// const { cellOption, mathOption, textOptions, contain, containType } = this.state;+// return (+// <>+// <p className={styles.ruleEditTitle}>{contain.title.label}</p>+// <div className={styles.ruleEditContent}>+// <select>+// {cellOption.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// {containType === 'cellValue' ? (+// <>+// <select>+// {mathOption.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// <CellRangeModal></CellRangeModal>+// </>+// ) : (+// ''+// )}+// {containType === 'specificText' ? (+// <>+// <select>+// {textOptions.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// <CellRangeModal></CellRangeModal>+// </>+// ) : (+// ''+// )}+// {containType === 'occurrence' ? (+// <>+// <input type="date" />+// </>+// ) : (+// ''+// )}+// </div>+// </>+// );+// }+// if (type === 'rank') {+// const { rankOption, rank } = this.state;+// const Checkbox = this.Render.renderFunction('Checkbox');++// const Input = this.Render.renderFunction('Input');+// return (+// <>+// <p className={styles.ruleEditTitle}>{rank.title.label}</p>+// <div className={styles.ruleEditContent}>+// <select>+// {rankOption.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// <Input />+// <Checkbox>{rank.subtitle.label}</Checkbox>+// </div>+// </>+// );+// }+// if (type === 'average') {+// const { averageOption, average } = this.state;+// return (+// <>+// <p className={styles.ruleEditTitle}>{average.title.label}</p>+// <div className={styles.ruleEditContent}>+// <select>+// {averageOption.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// <span>{average.subtitle.label}</span>+// </div>+// </>+// );+// }+// if (type === 'duplicate') {+// const { duplicateOption, duplicate } = this.state;+// return (+// <>+// <p className={styles.ruleEditTitle}>{duplicate.title.label}</p>+// <div className={styles.ruleEditContent}>+// <select>+// {duplicateOption.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// <span>{duplicate.subtitle.label}</span>+// </div>+// </>+// );+// }+// if (type === 'formula') {+// const { formula } = this.state;+// const CellRangeModal = this.Render.renderFunction('CellRangeModal');++// return (+// <>+// <p className={styles.ruleEditTitle}>{formula.title.label}</p>+// <div className={styles.ruleEditContent}>+// <CellRangeModal></CellRangeModal>+// </div>+// </>+// );+// }+// };++// pickTextColor = () => {};++// pickCellColor = () => {};++// cancelColor = () => {};++// render(props: RuleEditProps, state: RuleEditState) {+// const ColorPicker = this.Render.renderFunction('ColorPicker');+// const Checkbox = this.Render.renderFunction('Checkbox');+// const { type } = props;+// const { all, formatStyle, setting } = state;++// if (type === 'all') {+// return (+// <div className={styles.ruleEdit}>+// <p className={styles.ruleEditTitle}>{all.title.label}</p>+// <div className={styles.ruleEditItem}>+// <span>{all.formatStyle.label}:</span>+// <select>+// {formatStyle.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// </div>+// {this.getAllTypeContent()}+// </div>+// );+// }++// return (+// <div className={styles.ruleEdit}>+// <div>{this.getEditContent()}</div>+// <p className={styles.ruleEditTitle}>{setting.setAs.label}</p>+// <div className={styles.colorBox}>+// <div className={styles.colorItem}>+// <Checkbox>{setting.textColor.label}</Checkbox>+// <ColorPicker color="#9c0006" onClick={this.pickTextColor} onCancel={this.cancelColor}></ColorPicker>+// </div>+// <div className={styles.colorItem}>+// <Checkbox>{setting.cellColor.label}</Checkbox>+// <ColorPicker color="#ffc7ce" onClick={this.pickCellColor} onCancel={this.cancelColor}></ColorPicker>+// </div>+// </div>+// </div>+// );+// }+// }diff --git a/packages/sheets-plugin-conditional-format/src/UI/RuleManage.tsx b/packages/sheets-plugin-conditional-format/src/UI/RuleManage.tsxindex e287801544..8b06097523 100644--- a/packages/sheets-plugin-conditional-format/src/UI/RuleManage.tsx+++ b/packages/sheets-plugin-conditional-format/src/UI/RuleManage.tsx@@ -1,136 +1,136 @@-import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { SheetPlugin } from '@univerjs/base-sheets';-import styles from './index.module.less';+// import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { SheetPlugin } from '@univerjs/base-sheets';+// import styles from './index.module.less';-type RuleManageProps = {- config?: any;-};-type RuleManageState = {- title: LabelProps;- buttons: LabelProps[];- info: LabelProps[];-};-type LabelProps = {- name?: string;- label?: string;- value?: string;- active?: boolean;-};+// type RuleManageProps = {+// config?: any;+// };+// type RuleManageState = {+// title: LabelProps;+// buttons: LabelProps[];+// info: LabelProps[];+// };+// type LabelProps = {+// name?: string;+// label?: string;+// value?: string;+// active?: boolean;+// };-export class RuleManage extends Component<RuleManageProps, RuleManageState> {- private _localeObserver: Nullable<Observer<Workbook>>;+// export class RuleManage extends Component<RuleManageProps, RuleManageState> {+// private _localeObserver: Nullable<Observer<Workbook>>;- Render: BaseComponentRender;+// Render: BaseComponentRender;- initialize() {- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();+// initialize() {+// const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();- this.state = {- title: {- name: 'conditionalformat.showRules',- },- buttons: [- {- name: 'conditionalformat.newRule',- },- {- name: 'conditionalformat.editRule',- },- {- name: 'conditionalformat.deleteRule',- },- ],- info: [- {- name: 'conditionalformat.rule',- },- {- name: 'conditionalformat.format',- },- {- name: 'conditionalformat.applyRange',- },- ],- };- }+// this.state = {+// title: {+// name: 'conditionalformat.showRules',+// },+// buttons: [+// {+// name: 'conditionalformat.newRule',+// },+// {+// name: 'conditionalformat.editRule',+// },+// {+// name: 'conditionalformat.deleteRule',+// },+// ],+// info: [+// {+// name: 'conditionalformat.rule',+// },+// {+// name: 'conditionalformat.format',+// },+// {+// name: 'conditionalformat.applyRange',+// },+// ],+// };+// }- setLocale() {- // setLocale for diffrent type of modal- const locale = this._context.getLocale();- // set Locale for array- function getArrayLabel(arr: LabelProps[]) {- return arr.map((item) => {- item.label = locale.get(item.name || '');- return item;- });- }+// setLocale() {+// // setLocale for diffrent type of modal+// const locale = this._context.getLocale();+// // set Locale for array+// function getArrayLabel(arr: LabelProps[]) {+// return arr.map((item) => {+// item.label = locale.get(item.name || '');+// return item;+// });+// }- this.setState((prevState) => {- let { title, buttons, info } = prevState;- buttons = getArrayLabel(buttons);- info = getArrayLabel(info);+// this.setState((prevState) => {+// let { title, buttons, info } = prevState;+// buttons = getArrayLabel(buttons);+// info = getArrayLabel(info);- title.label = locale.get(title.name || '');+// title.label = locale.get(title.name || '');- return { title, buttons, info };- });- }+// return { title, buttons, info };+// });+// }- componentWillMount() {- this.setLocale();+// componentWillMount() {+// this.setLocale();- // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }+// // subscribe Locale change event+// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }- setValue = (value: object, fn?: () => void) => {- this.setState(- (prevState) => ({- ...value,- }),- fn- );- };+// setValue = (value: object, fn?: () => void) => {+// this.setState(+// (prevState) => ({+// ...value,+// }),+// fn+// );+// };- render(props: RuleManageProps, state: RuleManageState) {- const { title, buttons, info } = state;- const Button = this.Render.renderFunction('Button');+// render(props: RuleManageProps, state: RuleManageState) {+// const { title, buttons, info } = state;+// const Button = this.Render.renderFunction('Button');- return (- <div className={styles.ruleManage}>- <div>- <span>{title.label}</span>- <select></select>- </div>- <div className={styles.ruleBox}>- <div className={styles.ruleBtn}>- {buttons.map((item) => (- <Button>{item.label}</Button>- ))}- </div>- <div className={styles.ruleList}>- <div className={styles.listTitle}>- {info.map((item) => (- <span>{item.label}</span>- ))}- </div>- <div className={styles.listBox}>- <div className={styles.listItem}></div>- </div>- </div>- </div>- </div>- );- }-}+// return (+// <div className={styles.ruleManage}>+// <div>+// <span>{title.label}</span>+// <select></select>+// </div>+// <div className={styles.ruleBox}>+// <div className={styles.ruleBtn}>+// {buttons.map((item) => (+// <Button>{item.label}</Button>+// ))}+// </div>+// <div className={styles.ruleList}>+// <div className={styles.listTitle}>+// {info.map((item) => (+// <span>{item.label}</span>+// ))}+// </div>+// <div className={styles.listBox}>+// <div className={styles.listItem}></div>+// </div>+// </div>+// </div>+// </div>+// );+// }+// }diff --git a/packages/sheets-plugin-data-validation/src/UI/DataValidationButton.tsx b/packages/sheets-plugin-data-validation/src/UI/DataValidationButton.tsxindex 258b45a94f..5f8732608a 100644--- a/packages/sheets-plugin-data-validation/src/UI/DataValidationButton.tsx+++ b/packages/sheets-plugin-data-validation/src/UI/DataValidationButton.tsx@@ -1,170 +1,168 @@-import { BaseComponentRender, BaseComponentSheet, Component, IToolbarItemProps, ModalProps } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { SheetPlugin } from '@univerjs/base-sheets';-import { IProps } from '../IData/IDataValidation';-import { DataValidationContent } from './DataValidationContent';-import styles from './index.module.less';--// Types for state-interface IState {- dataValidation: IToolbarItemProps;- modalData: ModalProps[];- tip: LabelProps[];-}--type LabelProps = {- locale?: string;- label?: string;-};--export class DataValidationButton extends Component<IProps, IState> {- private _localeObserver: Nullable<Observer<Workbook>>;-- Render: BaseComponentRender;-- initialize(props: IProps) {- // super(props);- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();-- const CheckIcon = this.Render.renderFunction('CheckIcon');-- const dataValidationState: IToolbarItemProps = {- locale: 'dataValidation',- type: 'single',- label: <CheckIcon />,- show: true,- };-- this.state = {- dataValidation: dataValidationState,- tip: [- {- locale: 'dataValidation.tooltipInfo1',- },- ],- modalData: [- {- locale: 'dataValidation.dataValidationLabel',- show: false,- group: [- {- locale: 'button.confirm',- type: 'primary',- },- {- locale: 'dataValidation.deleteValidation',- },- {- locale: 'button.cancel',- },- ],- children: <DataValidationContent config={props.config} />,- onCancel: () => {- this.showModal(0, false);- },- },- {- show: false,- // children: <p>{this.state.tip[0].label}</p>,- group: [- {- locale: 'button.close',- },- ],- onCancel: () => {- this.showModal(1, false);- },- },- ],- };- }-- /**- * init- */- componentWillMount() {- this.setLocale();-- // subscribe Locale change event-- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }-- /**- * destory- */- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }-- /**- * set text by config setting and Locale message- */- setLocale() {- const locale = this._context.getLocale();- this.setState((prevState: IState) => {- let item = prevState.dataValidation;- // set current Locale string for tooltip- item.tooltip = locale.get(`${item.locale}`);-- let { modalData, tip } = prevState;- modalData.forEach((ele) => {- ele.title = ele.locale ? locale.get(ele.locale) : '';- if (ele.group && ele.group.length) {- ele.group.forEach((node) => {- node.label = locale.get(node.locale!);- });- }- });-- // tip.forEach((ele) => {- // ele.label = Locale.get(ele.locale!);- // });- return {- dataValidation: item,- modalData,- // tip,- };- });- }-- showModal = (index: number, isShow: boolean) => {- this.setState((prevState) => {- let { modalData } = prevState;-- modalData[index].show = isShow;- return {- modalData,- };- });- };-- /**- * Render the component's HTML- *- * @returns {void}- */- render(props: IProps, state: IState) {- const Button = this.Render.renderFunction('Button');- const Modal = this.Render.renderFunction('Modal');- const { dataValidation, modalData } = state;- // Set Provider for entire Container- return (- <div className={styles.singleButton}>- <Button type="text" onClick={() => this.showModal(0, true)}>- {dataValidation.label}- </Button>- {modalData.map((item, index) => {- if (!item.show) return;- return <Modal title={item.title} visible={item.show} group={item.group} children={item.children} onCancel={item.onCancel}></Modal>;- })}- </div>- );- }-}+// import { BaseComponentSheet, Component, IToolbarItemProps, ModalProps } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { SheetPlugin } from '@univerjs/base-sheets';+// import { IProps } from '../IData/IDataValidation';+// import { DataValidationContent } from './DataValidationContent';+// import styles from './index.module.less';++// // Types for state+// interface IState {+// dataValidation: IToolbarItemProps;+// modalData: ModalProps[];+// tip: LabelProps[];+// }++// type LabelProps = {+// locale?: string;+// label?: string;+// };++// export class DataValidationButton extends Component<IProps, IState> {+// private _localeObserver: Nullable<Observer<Workbook>>;++// initialize(props: IProps) {+// // super(props);+// const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();++// const CheckIcon = this.Render.renderFunction('CheckIcon');++// const dataValidationState: IToolbarItemProps = {+// locale: 'dataValidation',+// type: 'single',+// label: <CheckIcon />,+// show: true,+// };++// this.state = {+// dataValidation: dataValidationState,+// tip: [+// {+// locale: 'dataValidation.tooltipInfo1',+// },+// ],+// modalData: [+// {+// locale: 'dataValidation.dataValidationLabel',+// show: false,+// group: [+// {+// locale: 'button.confirm',+// type: 'primary',+// },+// {+// locale: 'dataValidation.deleteValidation',+// },+// {+// locale: 'button.cancel',+// },+// ],+// children: <DataValidationContent config={props.config} />,+// onCancel: () => {+// this.showModal(0, false);+// },+// },+// {+// show: false,+// // children: <p>{this.state.tip[0].label}</p>,+// group: [+// {+// locale: 'button.close',+// },+// ],+// onCancel: () => {+// this.showModal(1, false);+// },+// },+// ],+// };+// }++// /**+// * init+// */+// componentWillMount() {+// this.setLocale();++// // subscribe Locale change event++// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }++// /**+// * destory+// */+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }++// /**+// * set text by config setting and Locale message+// */+// setLocale() {+// const locale = this._context.getLocale();+// this.setState((prevState: IState) => {+// let item = prevState.dataValidation;+// // set current Locale string for tooltip+// item.tooltip = locale.get(`${item.locale}`);++// let { modalData, tip } = prevState;+// modalData.forEach((ele) => {+// ele.title = ele.locale ? locale.get(ele.locale) : '';+// if (ele.group && ele.group.length) {+// ele.group.forEach((node) => {+// node.label = locale.get(node.locale!);+// });+// }+// });++// // tip.forEach((ele) => {+// // ele.label = Locale.get(ele.locale!);+// // });+// return {+// dataValidation: item,+// modalData,+// // tip,+// };+// });+// }++// showModal = (index: number, isShow: boolean) => {+// this.setState((prevState) => {+// let { modalData } = prevState;++// modalData[index].show = isShow;+// return {+// modalData,+// };+// });+// };++// /**+// * Render the component's HTML+// *+// * @returns {void}+// */+// render(props: IProps, state: IState) {+// const Button = this.Render.renderFunction('Button');+// const Modal = this.Render.renderFunction('Modal');+// const { dataValidation, modalData } = state;+// // Set Provider for entire Container+// return (+// <div className={styles.singleButton}>+// <Button type="text" onClick={() => this.showModal(0, true)}>+// {dataValidation.label}+// </Button>+// {modalData.map((item, index) => {+// if (!item.show) return;+// return <Modal title={item.title} visible={item.show} group={item.group} children={item.children} onCancel={item.onCancel}></Modal>;+// })}+// </div>+// );+// }+// }diff --git a/packages/sheets-plugin-data-validation/src/UI/DataValidationContent.tsx b/packages/sheets-plugin-data-validation/src/UI/DataValidationContent.tsxindex 131fc94d2e..9ae8c7245b 100644--- a/packages/sheets-plugin-data-validation/src/UI/DataValidationContent.tsx+++ b/packages/sheets-plugin-data-validation/src/UI/DataValidationContent.tsx@@ -1,441 +1,441 @@-import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { SheetPlugin } from '@univerjs/base-sheets';-import styles from './index.module.less';+// import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { SheetPlugin } from '@univerjs/base-sheets';+// import styles from './index.module.less';-type DataValidationProps = {- config?: any;-};-type DataValidationState = {- range: LabelProps;- validation: LabelProps;- options: LabelProps[];- checkGroups: LabelProps[];- placeholder: LabelProps[];- checkValue: string[];- selected: LabelProps;- notSelected: LabelProps;- betweenOptions: LabelProps[];- textOptions: LabelProps[];- validityOptions: LabelProps[];- dateOptions: LabelProps[];-};-type LabelProps = {- name?: string;- label?: string;- value?: string;- checked?: boolean;-};+// type DataValidationProps = {+// config?: any;+// };+// type DataValidationState = {+// range: LabelProps;+// validation: LabelProps;+// options: LabelProps[];+// checkGroups: LabelProps[];+// placeholder: LabelProps[];+// checkValue: string[];+// selected: LabelProps;+// notSelected: LabelProps;+// betweenOptions: LabelProps[];+// textOptions: LabelProps[];+// validityOptions: LabelProps[];+// dateOptions: LabelProps[];+// };+// type LabelProps = {+// name?: string;+// label?: string;+// value?: string;+// checked?: boolean;+// };-export class DataValidationContent extends Component<DataValidationProps, DataValidationState> {- private _localeObserver: Nullable<Observer<Workbook>>;+// export class DataValidationContent extends Component<DataValidationProps, DataValidationState> {+// private _localeObserver: Nullable<Observer<Workbook>>;- Render: BaseComponentRender;+// Render: BaseComponentRender;- initialize() {- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();+// initialize() {+// const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();- this.state = {- range: {- name: 'dataValidation.cellRange',- },- validation: {- name: 'dataValidation.validationCondition',- },- options: [- {- name: 'dataValidation.dropdown',- value: '1',- },- {- name: 'dataValidation.checkbox',- value: '2',- },- {- name: 'dataValidation.number',- value: '3',- },- {- name: 'dataValidation.number_integer',- value: '3',- },- {- name: 'dataValidation.number_decimal',- value: '3',- },- {- name: 'dataValidation.text_content',- value: '4',- },- {- name: 'dataValidation.text_length',- value: '3',- },- {- name: 'dataValidation.date',- value: '5',- },- {- name: 'dataValidation.validity',- value: '6',- },- ],- checkGroups: [- {- name: 'dataValidation.remote',- value: '1',- checked: false,- },- {- name: 'dataValidation.prohibitInput',- value: '2',- },- {- name: 'dataValidation.hintShow',- value: '3',- },- ],- placeholder: [- {- name: 'dataValidation.placeholder5',- label: '',- },- {- name: 'dataValidation.placeholder1',- label: '',- },- {- name: 'dataValidation.placeholder2',- label: '',- },- {- name: 'dataValidation.placeholder4',- label: '',- },- ],- selected: {- name: 'dataValidation.selected',- label: '',- },- notSelected: {- name: 'dataValidation.notSelected',- label: '',- },- betweenOptions: [- {- name: 'dataValidation.between',- label: '',- value: '',- },- {- name: 'dataValidation.notBetween',- label: '',- value: '',- },- {- name: 'dataValidation.equal',- label: '',- value: '',- },- {- name: 'dataValidation.notEqualTo',- label: '',- value: '',- },- {- name: 'dataValidation.moreThanThe',- label: '',- value: '',- },- {- name: 'dataValidation.lessThan',- label: '',- value: '',- },- {- name: 'dataValidation.greaterOrEqualTo',- label: '',- value: '',- },- {- name: 'dataValidation.lessThanOrEqualTo',- label: '',- value: '',- },- ],- textOptions: [- {- name: 'dataValidation.include',- label: '',- value: '',- },- {- name: 'dataValidation.exclude',- label: '',- value: '',- },- {- name: 'dataValidation.equal',- label: '',- value: '',- },- ],- dateOptions: [- {- name: 'dataValidation.between',- label: '',- value: '',- },- {- name: 'dataValidation.notBetween',- label: '',- value: '',- },- {- name: 'dataValidation.equal',- label: '',- value: '',- },- {- name: 'dataValidation.notEqualTo',- label: '',- value: '',- },- {- name: 'dataValidation.earlierThan',- label: '',- value: '',- },- {- name: 'dataValidation.noEarlierThan',- label: '',- value: '',- },- {- name: 'dataValidation.laterThan',- label: '',- value: '',- },- {- name: 'dataValidation.noLaterThan',- label: '',- value: '',- },- ],- validityOptions: [- {- name: 'dataValidation.identificationNumber',- label: '',- value: '',- },- {- name: 'dataValidation.phoneNumber',- label: '',- value: '',- },- ],- selectValue: '1',- checkValue: [''],- };- }+// this.state = {+// range: {+// name: 'dataValidation.cellRange',+// },+// validation: {+// name: 'dataValidation.validationCondition',+// },+// options: [+// {+// name: 'dataValidation.dropdown',+// value: '1',+// },+// {+// name: 'dataValidation.checkbox',+// value: '2',+// },+// {+// name: 'dataValidation.number',+// value: '3',+// },+// {+// name: 'dataValidation.number_integer',+// value: '3',+// },+// {+// name: 'dataValidation.number_decimal',+// value: '3',+// },+// {+// name: 'dataValidation.text_content',+// value: '4',+// },+// {+// name: 'dataValidation.text_length',+// value: '3',+// },+// {+// name: 'dataValidation.date',+// value: '5',+// },+// {+// name: 'dataValidation.validity',+// value: '6',+// },+// ],+// checkGroups: [+// {+// name: 'dataValidation.remote',+// value: '1',+// checked: false,+// },+// {+// name: 'dataValidation.prohibitInput',+// value: '2',+// },+// {+// name: 'dataValidation.hintShow',+// value: '3',+// },+// ],+// placeholder: [+// {+// name: 'dataValidation.placeholder5',+// label: '',+// },+// {+// name: 'dataValidation.placeholder1',+// label: '',+// },+// {+// name: 'dataValidation.placeholder2',+// label: '',+// },+// {+// name: 'dataValidation.placeholder4',+// label: '',+// },+// ],+// selected: {+// name: 'dataValidation.selected',+// label: '',+// },+// notSelected: {+// name: 'dataValidation.notSelected',+// label: '',+// },+// betweenOptions: [+// {+// name: 'dataValidation.between',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.notBetween',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.equal',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.notEqualTo',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.moreThanThe',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.lessThan',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.greaterOrEqualTo',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.lessThanOrEqualTo',+// label: '',+// value: '',+// },+// ],+// textOptions: [+// {+// name: 'dataValidation.include',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.exclude',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.equal',+// label: '',+// value: '',+// },+// ],+// dateOptions: [+// {+// name: 'dataValidation.between',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.notBetween',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.equal',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.notEqualTo',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.earlierThan',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.noEarlierThan',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.laterThan',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.noLaterThan',+// label: '',+// value: '',+// },+// ],+// validityOptions: [+// {+// name: 'dataValidation.identificationNumber',+// label: '',+// value: '',+// },+// {+// name: 'dataValidation.phoneNumber',+// label: '',+// value: '',+// },+// ],+// selectValue: '1',+// checkValue: [''],+// };+// }- setLocale() {- const locale = this._context.getLocale();- this.setState((prevState) => {- let { range, validation, options, checkGroups, placeholder, selected, notSelected, betweenOptions, textOptions, validityOptions, dateOptions } = prevState;- range.label = locale.get(range.name);- validation.label = locale.get(validation.name);- options.forEach((item) => {- item.label = locale.get(item.name || '');- });- checkGroups.forEach((item) => {- item.label = locale.get(item.name);- });- placeholder.forEach((item) => {- item.label = locale.get(item.name);- });- selected.label = locale.get(selected.name);- notSelected.label = locale.get(notSelected.name);- betweenOptions.forEach((item) => {- item.label = locale.get(item.name);- });- textOptions.forEach((item) => {- item.label = locale.get(item.name);- });- validityOptions.forEach((item) => {- item.label = locale.get(item.name);- });- dateOptions.forEach((item) => {- item.label = locale.get(item.name);- });+// setLocale() {+// const locale = this._context.getLocale();+// this.setState((prevState) => {+// let { range, validation, options, checkGroups, placeholder, selected, notSelected, betweenOptions, textOptions, validityOptions, dateOptions } = prevState;+// range.label = locale.get(range.name);+// validation.label = locale.get(validation.name);+// options.forEach((item) => {+// item.label = locale.get(item.name || '');+// });+// checkGroups.forEach((item) => {+// item.label = locale.get(item.name);+// });+// placeholder.forEach((item) => {+// item.label = locale.get(item.name);+// });+// selected.label = locale.get(selected.name);+// notSelected.label = locale.get(notSelected.name);+// betweenOptions.forEach((item) => {+// item.label = locale.get(item.name);+// });+// textOptions.forEach((item) => {+// item.label = locale.get(item.name);+// });+// validityOptions.forEach((item) => {+// item.label = locale.get(item.name);+// });+// dateOptions.forEach((item) => {+// item.label = locale.get(item.name);+// });- return {- range,- validation,- options,- checkGroups,- betweenOptions,- textOptions,- validityOptions,- dateOptions,- };- });- }+// return {+// range,+// validation,+// options,+// checkGroups,+// betweenOptions,+// textOptions,+// validityOptions,+// dateOptions,+// };+// });+// }- componentWillMount() {- this.setLocale();+// componentWillMount() {+// this.setLocale();- // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }+// // subscribe Locale change event+// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }- setValue = (value: object, fn?: () => void) => {- this.setState(- (prevState) => ({- ...value,- }),- fn- );- };+// setValue = (value: object, fn?: () => void) => {+// this.setState(+// (prevState) => ({+// ...value,+// }),+// fn+// );+// };- handleSelect = (e: Event) => {- const target = e.target as HTMLSelectElement;- this.setValue({ selectValue: target.value });- };+// handleSelect = (e: Event) => {+// const target = e.target as HTMLSelectElement;+// this.setValue({ selectValue: target.value });+// };- // 不同验证条件显示样式- getSelectInfo() {- const CellRangeModal = this.Render.renderFunction('CellRangeModal');- const Input = this.Render.renderFunction('Input');- const { selectValue, placeholder, selected, notSelected, betweenOptions, textOptions, validityOptions, dateOptions } = this.state;- if (selectValue === '1') {- return <CellRangeModal placeholderProps={placeholder[1].label}></CellRangeModal>;- }- if (selectValue === '2') {- return (- <div className={styles.dataCheckbox}>- <div>- <span>{selected.label} ——</span>- <Input placeholder={placeholder[2].label} />- </div>- <div>- <span>{notSelected.label} ——</span>- <Input placeholder={placeholder[2].label} />- </div>- </div>- );- }- if (selectValue === '3') {- return (- <div className={styles.dataBetween}>- <select>- {betweenOptions.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- <div>- <Input placeholder="1" />- <span> -- </span>- <Input placeholder="100" />- </div>- </div>- );- }- if (selectValue === '4') {- return (- <div className={styles.dataText}>- <select>- {textOptions.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- <Input placeholder={placeholder[3].label} />- </div>- );- }- if (selectValue === '5') {- return (- <div className={styles.dataDate}>- <select>- {dateOptions.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- <div>- <input type="date" />- <span> - </span>- <input type="date" />- </div>- </div>- );- }- if (selectValue === '6') {- return (- <div className={styles.dataValidity}>- <select>- {validityOptions.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- </div>- );- }- }+// // 不同验证条件显示样式+// getSelectInfo() {+// const CellRangeModal = this.Render.renderFunction('CellRangeModal');+// const Input = this.Render.renderFunction('Input');+// const { selectValue, placeholder, selected, notSelected, betweenOptions, textOptions, validityOptions, dateOptions } = this.state;+// if (selectValue === '1') {+// return <CellRangeModal placeholderProps={placeholder[1].label}></CellRangeModal>;+// }+// if (selectValue === '2') {+// return (+// <div className={styles.dataCheckbox}>+// <div>+// <span>{selected.label} ——</span>+// <Input placeholder={placeholder[2].label} />+// </div>+// <div>+// <span>{notSelected.label} ——</span>+// <Input placeholder={placeholder[2].label} />+// </div>+// </div>+// );+// }+// if (selectValue === '3') {+// return (+// <div className={styles.dataBetween}>+// <select>+// {betweenOptions.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// <div>+// <Input placeholder="1" />+// <span> -- </span>+// <Input placeholder="100" />+// </div>+// </div>+// );+// }+// if (selectValue === '4') {+// return (+// <div className={styles.dataText}>+// <select>+// {textOptions.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// <Input placeholder={placeholder[3].label} />+// </div>+// );+// }+// if (selectValue === '5') {+// return (+// <div className={styles.dataDate}>+// <select>+// {dateOptions.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// <div>+// <input type="date" />+// <span> - </span>+// <input type="date" />+// </div>+// </div>+// );+// }+// if (selectValue === '6') {+// return (+// <div className={styles.dataValidity}>+// <select>+// {validityOptions.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// </div>+// );+// }+// }- checkboxHandle = (value: string[]) => {- let { checkGroups } = this.state;- checkGroups.forEach((item) => {- item.checked = false;- if (value.includes(item.value)) {- item.checked = true;- }- });- this.setValue({ checkValue: value, checkGroups });- };+// checkboxHandle = (value: string[]) => {+// let { checkGroups } = this.state;+// checkGroups.forEach((item) => {+// item.checked = false;+// if (value.includes(item.value)) {+// item.checked = true;+// }+// });+// this.setValue({ checkValue: value, checkGroups });+// };- // 选中时显示input- getCheckInfo() {- const Input = this.Render.renderFunction('Input');- const { checkValue, placeholder } = this.state;- if (checkValue.includes('3')) {- return <Input placeholder={placeholder[0].label} />;- }- }+// // 选中时显示input+// getCheckInfo() {+// const Input = this.Render.renderFunction('Input');+// const { checkValue, placeholder } = this.state;+// if (checkValue.includes('3')) {+// return <Input placeholder={placeholder[0].label} />;+// }+// }- render(props: DataValidationProps, state: DataValidationState) {- const CellRangeModal = this.Render.renderFunction('CellRangeModal');- const CheckboxGroup = this.Render.renderFunction('CheckboxGroup');- const { range, validation, options, checkGroups, placeholder } = state;- return (- <div className={styles.dataValidation}>- <div className={styles.boxItem}>- <p className={styles.title}>{range.label}</p>- <CellRangeModal></CellRangeModal>- </div>- <div className={styles.boxItem}>- <p className={styles.title}>{validation.label}</p>- <select onChange={this.handleSelect}>- {options.map((item) => (- <option value={item.value}>{item.label}</option>- ))}- </select>- {this.getSelectInfo()}- </div>- <div className={styles.boxItem}>- <CheckboxGroup options={checkGroups} onChange={this.checkboxHandle}></CheckboxGroup>- {this.getCheckInfo()}- </div>- </div>- );- }-}+// render(props: DataValidationProps, state: DataValidationState) {+// const CellRangeModal = this.Render.renderFunction('CellRangeModal');+// const CheckboxGroup = this.Render.renderFunction('CheckboxGroup');+// const { range, validation, options, checkGroups, placeholder } = state;+// return (+// <div className={styles.dataValidation}>+// <div className={styles.boxItem}>+// <p className={styles.title}>{range.label}</p>+// <CellRangeModal></CellRangeModal>+// </div>+// <div className={styles.boxItem}>+// <p className={styles.title}>{validation.label}</p>+// <select onChange={this.handleSelect}>+// {options.map((item) => (+// <option value={item.value}>{item.label}</option>+// ))}+// </select>+// {this.getSelectInfo()}+// </div>+// <div className={styles.boxItem}>+// <CheckboxGroup options={checkGroups} onChange={this.checkboxHandle}></CheckboxGroup>+// {this.getCheckInfo()}+// </div>+// </div>+// );+// }+// }diff --git a/packages/sheets-plugin-find/src/Locale/en.ts b/packages/sheets-plugin-find/src/Locale/en.tsindex 9f484c4d19..bec17e12f4 100644--- a/packages/sheets-plugin-find/src/Locale/en.ts+++ b/packages/sheets-plugin-find/src/Locale/en.ts@@ -49,7 +49,7 @@ export default {noReplceTip: 'There is nothing to replace',noMatchTip: 'No match found',- successTip: '${xlength} items found',+ // successTip: "${xlength} items found",locationConstant: 'Const',locationFormula: 'Formula',diff --git a/packages/sheets-plugin-find/src/Locale/zh.ts b/packages/sheets-plugin-find/src/Locale/zh.tsindex 7a054a6c78..5802ca5e32 100644--- a/packages/sheets-plugin-find/src/Locale/zh.ts+++ b/packages/sheets-plugin-find/src/Locale/zh.ts@@ -49,7 +49,7 @@ export default {noMatchTip: '找不到匹配项',search: '搜索',- successTip: '已经帮您搜索并进行了${xlength}处替换',+ // successTip: '已经帮您搜索并进行了${xlength}处替换',locationConstant: '常量',locationFormula: '公式',diff --git a/packages/sheets-plugin-find/src/View/UI/LocationContent.tsx b/packages/sheets-plugin-find/src/View/UI/LocationContent.tsxindex fc9ceaade4..4a81f76c97 100644--- a/packages/sheets-plugin-find/src/View/UI/LocationContent.tsx+++ b/packages/sheets-plugin-find/src/View/UI/LocationContent.tsx@@ -1,7 +1,4 @@-import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { SheetPlugin } from '@univerjs/base-sheets';-import styles from './index.module.less';+import { Component } from '@univerjs/base-ui';type LocationProps = {config: any;@@ -20,74 +17,75 @@ type LabelProps = {};export class LocationContent extends Component<LocationProps, LocationState> {- private _localeObserver: Nullable<Observer<Workbook>>;+ // private _localeObserver: Nullable<Observer<Workbook>>;- Render: BaseComponentRender;+ // Render: BaseComponentRender;- initialize() {- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();- this.state = {- radioGroup: [],- active: '1',- };- }+ // initialize() {+ // const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+ // this.Render = component.getComponentRender();+ // this.state = {+ // radioGroup: [],+ // active: '1',+ // };+ // }- handleChange = (value: string) => {- let { radioGroup } = this.state;- radioGroup.forEach((item) => {- if (item.children) {- item.children.forEach((ele) => {- ele.disabled = true;- });- }- });+ // handleChange = (value: string) => {+ // let { radioGroup } = this.state;+ // radioGroup.forEach((item) => {+ // if (item.children) {+ // item.children.forEach((ele) => {+ // ele.disabled = true;+ // });+ // }+ // });- radioGroup.forEach((item) => {- if (item.value === value) {- if (item.children) {- item.children.forEach((ele) => {- ele.disabled = false;- });- }- this.setValue({ active: value, radioGroup });- }- });- };+ // radioGroup.forEach((item) => {+ // if (item.value === value) {+ // if (item.children) {+ // item.children.forEach((ele) => {+ // ele.disabled = false;+ // });+ // }+ // this.setValue({ active: value, radioGroup });+ // }+ // });+ // };- handleCheckbox = (value: string[], locale: string) => {- let { radioGroup } = this.state;- let index = radioGroup.findIndex((item) => item.locale === locale);- radioGroup[index].children!.forEach((ele) => {- if (value.includes(ele.value)) {- ele.checked = true;- } else {- ele.checked = false;- }- });- this.setValue({ radioGroup });- };+ // handleCheckbox = (value: string[], locale: string) => {+ // let { radioGroup } = this.state;+ // let index = radioGroup.findIndex((item) => item.locale === locale);+ // radioGroup[index].children!.forEach((ele) => {+ // if (value.includes(ele.value)) {+ // ele.checked = true;+ // } else {+ // ele.checked = false;+ // }+ // });+ // this.setValue({ radioGroup });+ // };render() {- const CheckboxGroup = this.Render.renderFunction('CheckboxGroup');- const Radio = this.Render.renderFunction('Radio');- const RadioGroup = this.Render.renderFunction('RadioGroup');- const { radioGroup, active } = this.state;+ // const CheckboxGroup = this.Render.renderFunction('CheckboxGroup');+ // const Radio = this.Render.renderFunction('Radio');+ // const RadioGroup = this.Render.renderFunction('RadioGroup');+ // const { radioGroup, active } = this.state;return (- <div className={styles.locationContent}>- <RadioGroup vertical={true} onChange={this.handleChange} active={active}>- {radioGroup.map((item) => {- if (item.children) {- return (- <Radio value={item.value} label={item.label}>- <CheckboxGroup options={item.children} onChange={(value) => this.handleCheckbox(value, item.locale)} />- </Radio>- );- }- return <Radio value={item.value} label={item.label}></Radio>;- })}- </RadioGroup>- </div>+ <div></div>+ // <div className={styles.locationContent}>+ // <RadioGroup vertical={true} onChange={this.handleChange} active={active}>+ // {radioGroup.map((item) => {+ // if (item.children) {+ // return (+ // <Radio value={item.value} label={item.label}>+ // <CheckboxGroup options={item.children} onChange={(value) => this.handleCheckbox(value, item.locale)} />+ // </Radio>+ // );+ // }+ // return <Radio value={item.value} label={item.label}></Radio>;+ // })}+ // </RadioGroup>+ // </div>);}}diff --git a/packages/sheets-plugin-find/src/View/UI/SearchContent.tsx b/packages/sheets-plugin-find/src/View/UI/SearchContent.tsxindex a19777e731..698744c9ad 100644--- a/packages/sheets-plugin-find/src/View/UI/SearchContent.tsx+++ b/packages/sheets-plugin-find/src/View/UI/SearchContent.tsx@@ -1,8 +1,5 @@-import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';+import { Component } from '@univerjs/base-ui';import { Nullable } from '@univerjs/core';-import { FIND_PLUGIN_NAME } from '../../Const/PLUGIN_NAME';-import { FindPlugin } from '../../FindPlugin';-import styles from './index.module.less';interface SearchProps {config: any;@@ -28,87 +25,88 @@ type LabelProps = {};export class SearchContent extends Component<SearchProps, SearchState> {- Render: BaseComponentRender;+ // Render: BaseComponentRender;- initialize() {- const component = this._context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();- this.state = {- tab: [],- content: [],- buttons: [],- match: [],- changeSearchText: null,- getMatch: null,- };- }+ // initialize() {+ // const component = this._context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+ // this.Render = component.getComponentRender();+ // this.state = {+ // tab: [],+ // content: [],+ // buttons: [],+ // match: [],+ // changeSearchText: null,+ // getMatch: null,+ // };+ // }- componentDidMount() {- const plugin = this._context.getPluginManager().getPluginByName<FindPlugin>(FIND_PLUGIN_NAME)!;- plugin.getObserver('onSearchContentDidMountObservable')!.notifyObservers(this);- }+ // componentDidMount() {+ // const plugin = this._context.getPluginManager().getPluginByName<FindPlugin>(FIND_PLUGIN_NAME)!;+ // plugin.getObserver('onSearchContentDidMountObservable')!.notifyObservers(this);+ // }- setSearchData(data: any) {- this.setState({- ...data,- });- }+ // setSearchData(data: any) {+ // this.setState({+ // ...data,+ // });+ // }render(props: SearchProps, state: SearchState) {- const Tab = this.Render.renderFunction('Tab');- const TabPane = this.Render.renderFunction('TabPane');- const Button = this.Render.renderFunction('Button');- const CheckboxGroup = this.Render.renderFunction('CheckboxGroup');- const Input = this.Render.renderFunction('Input');- const { tab, content, match, buttons, changeSearchText, getMatch } = state;- const { activeKey } = props;+ // const Tab = this.Render.renderFunction('Tab');+ // const TabPane = this.Render.renderFunction('TabPane');+ // const Button = this.Render.renderFunction('Button');+ // const CheckboxGroup = this.Render.renderFunction('CheckboxGroup');+ // const Input = this.Render.renderFunction('Input');+ // const { tab, content, match, buttons, changeSearchText, getMatch } = state;+ // const { activeKey } = props;- if (!changeSearchText || !getMatch) return;+ // if (!changeSearchText || !getMatch) return;return (- <Tab activeKey={activeKey} type="card">- {tab.map((item, index) => (- <TabPane tab={item.label} keys={item.key} key={index}>- <div className={styles.tabBox}>- <div className={styles.inputBox}>- <div className={styles.textBox}>- <div>- <span>{content[0].label}: </span>- <Input onChange={(e: Event) => changeSearchText(e)} />- </div>- {item.key === 'replace' ? (- <div>- <span>{content[1].label}: </span>- <Input />- </div>- ) : (- <></>- )}- </div>- <div>- <CheckboxGroup options={match} onChange={getMatch}></CheckboxGroup>- </div>- </div>- <div className={styles.btnBox}>- {buttons.map((item, index) => {- if (item.key === 'replace') {- return (- <Button key={index} onClick={item.onClick}>- {item.label}- </Button>- );- }- return (- <Button key={index} onClick={item.onClick}>- {item.label}- </Button>- );- })}- </div>- </div>- </TabPane>- ))}- </Tab>+ <div></div>+ // <Tab activeKey={activeKey} type="card">+ // {tab.map((item, index) => (+ // <TabPane tab={item.label} keys={item.key} key={index}>+ // <div className={styles.tabBox}>+ // <div className={styles.inputBox}>+ // <div className={styles.textBox}>+ // <div>+ // <span>{content[0].label}: </span>+ // <Input onChange={(e: Event) => changeSearchText(e)} />+ // </div>+ // {item.key === 'replace' ? (+ // <div>+ // <span>{content[1].label}: </span>+ // <Input />+ // </div>+ // ) : (+ // <></>+ // )}+ // </div>+ // <div>+ // <CheckboxGroup options={match} onChange={getMatch}></CheckboxGroup>+ // </div>+ // </div>+ // <div className={styles.btnBox}>+ // {buttons.map((item, index) => {+ // if (item.key === 'replace') {+ // return (+ // <Button key={index} onClick={item.onClick}>+ // {item.label}+ // </Button>+ // );+ // }+ // return (+ // <Button key={index} onClick={item.onClick}>+ // {item.label}+ // </Button>+ // );+ // })}+ // </div>+ // </div>+ // </TabPane>+ // ))}+ // </Tab>);}}diff --git a/packages/sheets-plugin-find/src/View/UI/fuben.tsx b/packages/sheets-plugin-find/src/View/UI/fuben.tsxdeleted file mode 100644index 9d1c9a2eb5..0000000000--- a/packages/sheets-plugin-find/src/View/UI/fuben.tsx+++ /dev/null@@ -1,282 +0,0 @@-import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { SheetPlugin } from '@univerjs/base-sheets';-// import { Button, CheckboxGroup, Input, Tab, TabPane } from '@univerjs/style-univer';-import styles from './index.module.less';-import { FindPlugin } from '../../FindPlugin';--interface SearchProps {- config: any;- activeKey?: string;-}-interface ContentProps extends SearchProps {- keys?: string;-}-type SearchState = {- tab: LabelProps[];-};-type ContentState = {- content: LabelProps[];- match: LabelProps[];- buttons: LabelProps[];-};-type LabelProps = {- name: string;- label?: string;- value?: string;- key?: string;- onClick?: () => void;-};--export class SearchContent extends Component<SearchProps, SearchState> {- private _localeObserver: Nullable<Observer<Workbook>>;-- Render: BaseComponentRender;-- initialize() {- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();- this.state = {- tab: [- {- name: 'find.find',- key: 'find',- },- {- name: 'find.replace',- key: 'replace',- },- ],- };- }-- setLocale() {- const locale = this._context.getLocale();- this.setState((prevState) => {- let { tab } = prevState;-- tab.forEach((item) => {- item.label = locale.get(item.name);- });-- return {- tab,- };- });- }-- componentWillMount() {- this.setLocale();-- // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }-- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }-- setValue = (value: object, fn?: () => void) => {- this.setState(- (prevState) => ({- ...value,- }),- fn- );- };-- render(props: SearchProps, state: SearchState) {- const Tab = this.Render.renderFunction('Tab');- const TabPane = this.Render.renderFunction('TabPane');- const { tab } = state;- const { config, activeKey } = props;- return (- <Tab activeKey={activeKey} type="card">- {tab.map((item, index) => (- <TabPane tab={item.label} keys={item.key} key={index}>- <Content config={config} keys={item.key}></Content>- </TabPane>- ))}- </Tab>- );- }-}--// tab content-class Content extends Component<ContentProps, ContentState> {- Render: BaseComponentRender;-- private _localeObserver: Nullable<Observer<Workbook>>;-- private _searchText: string | RegExp;-- private _matchList: string[] = []; // match condition list-- initialize(props: ContentProps) {- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();-- // super(props);- this._context = props.config.context;- this.state = {- content: [- {- name: 'find.findTextbox',- },- {- name: 'find.replaceTextbox',- },- ],- buttons: [- {- name: 'find.allFindBtn',- key: 'find',- onClick: () => this.findText(true),- },- {- name: 'find.findBtn',- key: 'find',- onClick: () => this.findText(),- },- {- name: 'find.allReplaceBtn',- key: 'replace',- },- {- name: 'find.replaceBtn',- key: 'replace',- },- ],- match: [- {- name: 'find.regexTextbox',- value: 'regex',- },- {- name: 'find.wholeTextbox',- value: 'whole',- },- {- name: 'find.distinguishTextbox',- value: 'capslock',- },- ],- };- }-- private setLocale() {- const locale = this._context.getLocale();- this.setState((prevState) => {- let { content, buttons, match } = prevState;-- content.forEach((item) => {- item.label = locale.get(item.name);- });- buttons.forEach((item) => {- item.label = locale.get(item.name);- });- match.forEach((item) => {- item.label = locale.get(item.name);- });-- return {- content,- buttons,- match,- };- });- }-- componentWillMount() {- this.setLocale();-- // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }-- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }-- // get search text- private changeSearchText = (e: Event) => {- const target = e.target as HTMLInputElement;- this._searchText = target.value;- };-- // get match condition- private getMatch = (value: string[]) => {- this._matchList = value;- };-- private findText = (isFull?: boolean) => {- // @ts-ignore- // TODO ...- // BUG- let textFinder = this._context.getPluginManager().getPluginByName<FindPlugin>('pluginFind')!.createTextFinder('A1:B10', this._searchText);- if (this._matchList.includes('capslock')) textFinder = textFinder.matchCase(true);- if (this._matchList.includes('whole')) textFinder = textFinder.matchEntireCell(true);- if (isFull) {- textFinder.findAll();- } else {- textFinder.findNext();- }- };-- render(props: ContentProps, state: ContentState) {- const Button = this.Render.renderFunction('Button');- const CheckboxGroup = this.Render.renderFunction('CheckboxGroup');- const Input = this.Render.renderFunction('Input');- const { keys } = props;- const { content, buttons, match } = state;- return (- <div className={styles.tabBox}>- <div className={styles.inputBox}>- <div className={styles.textBox}>- <div>- <span>{content[0].label}: </span>- <Input onChange={(e: Event) => this.changeSearchText(e)} />- </div>- {keys === 'replace' ? (- <div>- <span>{content[1].label}: </span>- <Input />- </div>- ) : (- <></>- )}- </div>- <div>- <CheckboxGroup options={match} onChange={this.getMatch}></CheckboxGroup>- </div>- </div>- <div className={styles.btnBox}>- {buttons.map((item, index) => {- if (keys === 'replace') {- return (- <Button key={index} onClick={item.onClick}>- {item.label}- </Button>- );- }- return (- <Button key={index} onClick={item.onClick}>- {item.label}- </Button>- );- })}- </div>- </div>- );- }-}diff --git a/packages/sheets-plugin-freeze/src/View/UI/FreezeButton.tsx b/packages/sheets-plugin-freeze/src/View/UI/FreezeButton.tsxindex 59fcfebfae..0c6b2f5a2d 100644--- a/packages/sheets-plugin-freeze/src/View/UI/FreezeButton.tsx+++ b/packages/sheets-plugin-freeze/src/View/UI/FreezeButton.tsx@@ -1,139 +1,139 @@-import { BaseComponentRender, BaseComponentSheet, BaseSelectProps, Component, ISelectButton, IToolbarItemProps } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { SheetPlugin } from '@univerjs/base-sheets';-import { IConfig } from '../../IData';+// import { BaseComponentRender, BaseComponentSheet, BaseSelectProps, Component, ISelectButton, IToolbarItemProps } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { SheetPlugin } from '@univerjs/base-sheets';+// import { IConfig } from '../../IData';-interface IProps {- config: IConfig;-}+// interface IProps {+// config: IConfig;+// }-// Types for state-interface IState {- frozen: IToolbarItemProps;-}+// // Types for state+// interface IState {+// frozen: IToolbarItemProps;+// }-export class FreezeButton extends Component<IProps, IState> {- private _localeObserver: Nullable<Observer<Workbook>>;+// export class FreezeButton extends Component<IProps, IState> {+// private _localeObserver: Nullable<Observer<Workbook>>;- Render: BaseComponentRender;+// Render: BaseComponentRender;- initialize(props: IProps) {- // super(props);- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();- const NextIcon = this.Render.renderFunction('NextIcon');- const FreezeIcon = this.Render.renderFunction('FreezeIcon');+// initialize(props: IProps) {+// // super(props);+// const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();+// const NextIcon = this.Render.renderFunction('NextIcon');+// const FreezeIcon = this.Render.renderFunction('FreezeIcon');- this.state = {- frozen: {- locale: 'frozen',- type: 'select',- label: <FreezeIcon />,- icon: <NextIcon />,- show: true,- border: false,- selectType: ISelectButton.DOUBLE,- needChange: false,- children: [- {- locale: 'frozen.default',- },- {- locale: 'frozen.frozenRow',- },- {- locale: 'frozen.frozenColumn',- },- {- locale: 'frozen.frozenRC',- border: true,- },- {- locale: 'frozen.frozenRowRange',- },- {- locale: 'frozen.frozenColumnRange',- },- {- locale: 'frozen.frozenRCRange',- },- {- locale: 'frozen.frozenCancel',- border: true,- },- ],- },- };- }+// this.state = {+// frozen: {+// locale: 'frozen',+// type: 'select',+// label: <FreezeIcon />,+// icon: <NextIcon />,+// show: true,+// border: false,+// selectType: ISelectButton.DOUBLE,+// needChange: false,+// children: [+// {+// locale: 'frozen.default',+// },+// {+// locale: 'frozen.frozenRow',+// },+// {+// locale: 'frozen.frozenColumn',+// },+// {+// locale: 'frozen.frozenRC',+// border: true,+// },+// {+// locale: 'frozen.frozenRowRange',+// },+// {+// locale: 'frozen.frozenColumnRange',+// },+// {+// locale: 'frozen.frozenRCRange',+// },+// {+// locale: 'frozen.frozenCancel',+// border: true,+// },+// ],+// },+// };+// }- /**- * init- */- componentWillMount() {- this.setLocale();+// /**+// * init+// */+// componentWillMount() {+// this.setLocale();- // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }+// // subscribe Locale change event+// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }- /**- * destory- */- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }+// /**+// * destory+// */+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }- /**- * set text by config setting and Locale message- */- setLocale() {- const locale = this._context.getLocale();- this.setState((prevState: IState) => {- let item = prevState.frozen;- // set current Locale string for tooltip- item.tooltip = locale.get(`frozen.${item.locale}Label`);- item.tooltipRight = locale.get(`frozen.${item.locale}RightLabel`);+// /**+// * set text by config setting and Locale message+// */+// setLocale() {+// const locale = this._context.getLocale();+// this.setState((prevState: IState) => {+// let item = prevState.frozen;+// // set current Locale string for tooltip+// item.tooltip = locale.get(`frozen.${item.locale}Label`);+// item.tooltipRight = locale.get(`frozen.${item.locale}RightLabel`);- // set current Locale string for select- item.children?.forEach((ele: IToolbarItemProps) => {- if (ele.locale) {- ele.label = locale.get(`${ele.locale}`);- }- });- item.label = typeof item.label === 'object' ? item.label : item.children![0].label;+// // set current Locale string for select+// item.children?.forEach((ele: IToolbarItemProps) => {+// if (ele.locale) {+// ele.label = locale.get(`${ele.locale}`);+// }+// });+// item.label = typeof item.label === 'object' ? item.label : item.children![0].label;- return {- frozen: item,- };- });- }+// return {+// frozen: item,+// };+// });+// }- /**- * Render the component's HTML- *- * @returns- */- render(props: IProps, state: IState) {- const Select = this.Render.renderFunction('Select');- const { frozen } = state;- // Set Provider for entire Container- return (- <Select- tooltip={frozen.tooltip}- tooltipRight={frozen.tooltipRight}- border={frozen.border}- selectType={frozen.selectType}- needChange={frozen.needChange}- key={frozen.locale}- children={frozen.children as BaseSelectProps[]}- label={frozen.label}- icon={frozen.icon}- />- );- }-}+// /**+// * Render the component's HTML+// *+// * @returns+// */+// render(props: IProps, state: IState) {+// const Select = this.Render.renderFunction('Select');+// const { frozen } = state;+// // Set Provider for entire Container+// return (+// <Select+// tooltip={frozen.tooltip}+// tooltipRight={frozen.tooltipRight}+// border={frozen.border}+// selectType={frozen.selectType}+// needChange={frozen.needChange}+// key={frozen.locale}+// children={frozen.children as BaseSelectProps[]}+// label={frozen.label}+// icon={frozen.icon}+// />+// );+// }+// }diff --git a/packages/sheets-plugin-link/src/UI/LinkButton.tsx b/packages/sheets-plugin-link/src/UI/LinkButton.tsxindex 7ae7f20c87..4da8999950 100644--- a/packages/sheets-plugin-link/src/UI/LinkButton.tsx+++ b/packages/sheets-plugin-link/src/UI/LinkButton.tsx@@ -1,135 +1,135 @@-import { BaseComponentRender, BaseComponentSheet, Component, IToolbarItemProps, ModalProps } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { Icon } from '@univerjs/style-univer';-import { IProps } from '../IData/ILink';-import styles from './index.module.less';-import { LinkContent } from './LinkContent';--// Types for state-interface IState {- insertLink: IToolbarItemProps;- modalData: ModalProps[];-}--const insertLink: IToolbarItemProps = {- locale: 'toolbar.insertLink',- type: 'single',- label: <Icon.Insert.LinkIcon />,- show: true,-};--export class LinkButton extends Component<IProps, IState> {- private _localeObserver: Nullable<Observer<Workbook>>;-- Render: BaseComponentRender;-- initialize(props: IProps) {- // super(props);- const component = this.props.config.context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();-- this.state = {- insertLink,- modalData: [- {- locale: 'insertLink.insertLinkLabel',- group: [- {- locale: 'button.confirm',- type: 'primary',- },- {- locale: 'button.cancel',- },- ],- show: false,- children: <LinkContent config={this.props} />,- onCancel: () => this.showModal(0, false),- },- ],- };- }-- /**- * init- */- componentWillMount() {- this.setLocale();-- // subscribe Locale change event-- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }-- /**- * destory- */- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }-- /**- * set text by config setting and Locale message- */- setLocale() {- const locale = this._context.getLocale();- this.setState((prevState: IState) => {- let item = prevState.insertLink;- // set current Locale string for tooltip- item.tooltip = locale.get(`${item.locale}`);-- let modalData = prevState.modalData;- modalData.forEach((ele) => {- ele.title = locale.get(ele.locale!);- if (ele.group && ele.group.length) {- ele.group.forEach((node) => {- node.label = locale.get(node.locale!);- });- }- });-- return {- insertLink: item,- modalData,- };- });- }-- showModal = (index: number, isShow: boolean) => {- let { modalData } = this.state;- modalData[index].show = isShow;- this.setState((prevState) => ({- modalData,- }));- };-- /**- * Render the component's HTML- *- * @returns {void}- */- render(props: IProps, state: IState) {- const Button = this.Render.renderFunction('Button');- const Modal = this.Render.renderFunction('Modal');-- // eslint-disable-next-line @typescript-eslint/no-shadow- const { insertLink, modalData } = state;- // Set Provider for entire Container- return (- <div className={styles.singleButton}>- <Button type="text" onClick={() => this.showModal(0, true)}>- {insertLink.label}- </Button>- {modalData.map((item) => {- if (!item.show) return;- return <Modal title={item.title} visible={item.show} group={item.group} children={item.children} onCancel={item.onCancel}></Modal>;- })}- </div>- );- }-}+// import { BaseComponentRender, BaseComponentSheet, Component, IToolbarItemProps, ModalProps } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { Icon } from '@univerjs/style-univer';+// import { IProps } from '../IData/ILink';+// import styles from './index.module.less';+// import { LinkContent } from './LinkContent';++// // Types for state+// interface IState {+// insertLink: IToolbarItemProps;+// modalData: ModalProps[];+// }++// const insertLink: IToolbarItemProps = {+// locale: 'toolbar.insertLink',+// type: 'single',+// label: <Icon.Insert.LinkIcon />,+// show: true,+// };++// export class LinkButton extends Component<IProps, IState> {+// private _localeObserver: Nullable<Observer<Workbook>>;++// Render: BaseComponentRender;++// initialize(props: IProps) {+// // super(props);+// const component = this.props.config.context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();++// this.state = {+// insertLink,+// modalData: [+// {+// locale: 'insertLink.insertLinkLabel',+// group: [+// {+// locale: 'button.confirm',+// type: 'primary',+// },+// {+// locale: 'button.cancel',+// },+// ],+// show: false,+// children: <LinkContent config={this.props} />,+// onCancel: () => this.showModal(0, false),+// },+// ],+// };+// }++// /**+// * init+// */+// componentWillMount() {+// this.setLocale();++// // subscribe Locale change event++// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }++// /**+// * destory+// */+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }++// /**+// * set text by config setting and Locale message+// */+// setLocale() {+// const locale = this._context.getLocale();+// this.setState((prevState: IState) => {+// let item = prevState.insertLink;+// // set current Locale string for tooltip+// item.tooltip = locale.get(`${item.locale}`);++// let modalData = prevState.modalData;+// modalData.forEach((ele) => {+// ele.title = locale.get(ele.locale!);+// if (ele.group && ele.group.length) {+// ele.group.forEach((node) => {+// node.label = locale.get(node.locale!);+// });+// }+// });++// return {+// insertLink: item,+// modalData,+// };+// });+// }++// showModal = (index: number, isShow: boolean) => {+// let { modalData } = this.state;+// modalData[index].show = isShow;+// this.setState((prevState) => ({+// modalData,+// }));+// };++// /**+// * Render the component's HTML+// *+// * @returns {void}+// */+// render(props: IProps, state: IState) {+// const Button = this.Render.renderFunction('Button');+// const Modal = this.Render.renderFunction('Modal');++// // eslint-disable-next-line @typescript-eslint/no-shadow+// const { insertLink, modalData } = state;+// // Set Provider for entire Container+// return (+// <div className={styles.singleButton}>+// <Button type="text" onClick={() => this.showModal(0, true)}>+// {insertLink.label}+// </Button>+// {modalData.map((item) => {+// if (!item.show) return;+// return <Modal title={item.title} visible={item.show} group={item.group} children={item.children} onCancel={item.onCancel}></Modal>;+// })}+// </div>+// );+// }+// }diff --git a/packages/sheets-plugin-link/src/UI/LinkContent.tsx b/packages/sheets-plugin-link/src/UI/LinkContent.tsxindex e240749554..fc754b5513 100644--- a/packages/sheets-plugin-link/src/UI/LinkContent.tsx+++ b/packages/sheets-plugin-link/src/UI/LinkContent.tsx@@ -1,192 +1,192 @@-import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { IProps } from '../IData';-import styles from './index.module.less';+// import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { IProps } from '../IData';+// import styles from './index.module.less';-type LinkContentProps = {- config: IProps;-};-type LinkContentBaseProps = {- name: string;- show: boolean;- label?: string;- type: string;- id: string;- placeholder?: {- name?: string;- label?: string;- };- children?: Array<Record<string, string>>;- onChange?: (e: Event) => void;-};-type LinkContentState = {- data: LinkContentBaseProps[];- type: string;-};-export class LinkContent extends Component<LinkContentProps, LinkContentState> {- private _localeObserver: Nullable<Observer<Workbook>>;+// type LinkContentProps = {+// config: IProps;+// };+// type LinkContentBaseProps = {+// name: string;+// show: boolean;+// label?: string;+// type: string;+// id: string;+// placeholder?: {+// name?: string;+// label?: string;+// };+// children?: Array<Record<string, string>>;+// onChange?: (e: Event) => void;+// };+// type LinkContentState = {+// data: LinkContentBaseProps[];+// type: string;+// };+// export class LinkContent extends Component<LinkContentProps, LinkContentState> {+// private _localeObserver: Nullable<Observer<Workbook>>;- Render: BaseComponentRender;+// Render: BaseComponentRender;- initialize(props: LinkContentProps) {- // super(props);- const component = this.props.config.config.context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();+// initialize(props: LinkContentProps) {+// // super(props);+// const component = this.props.config.config.context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();- this.state = {- data: [- {- name: 'insertLink.linkText',- show: true,- type: 'single',- id: 'linkText',- },- {- name: 'insertLink.linkType',- show: true,- type: 'select',- id: 'linkType',- onChange: (e: Event) => this.changeLinkType(e),- children: [- {- name: 'insertLink.external',- value: 'external',- },- {- name: 'insertLink.internal',- value: 'internal',- },- ],- },- {- name: 'insertLink.linkAddress',- show: true,- type: 'single',- id: 'linkAddress',- placeholder: { name: 'insertLink.placeholder1' },- },- {- name: 'insertLink.linkSheet',- id: 'linkSheet',- show: false,- type: 'select',- },- {- name: 'insertLink.linkCell',- show: false,- id: 'linkCell',- type: 'single',- placeholder: { name: 'insertLink.placeholder2' },- },- {- name: 'insertLink.linkTooltip',- show: true,- id: 'linkTooltip',- type: 'single',- placeholder: { name: 'insertLink.placeholder3' },- },- ],- type: 'single',- };- }+// this.state = {+// data: [+// {+// name: 'insertLink.linkText',+// show: true,+// type: 'single',+// id: 'linkText',+// },+// {+// name: 'insertLink.linkType',+// show: true,+// type: 'select',+// id: 'linkType',+// onChange: (e: Event) => this.changeLinkType(e),+// children: [+// {+// name: 'insertLink.external',+// value: 'external',+// },+// {+// name: 'insertLink.internal',+// value: 'internal',+// },+// ],+// },+// {+// name: 'insertLink.linkAddress',+// show: true,+// type: 'single',+// id: 'linkAddress',+// placeholder: { name: 'insertLink.placeholder1' },+// },+// {+// name: 'insertLink.linkSheet',+// id: 'linkSheet',+// show: false,+// type: 'select',+// },+// {+// name: 'insertLink.linkCell',+// show: false,+// id: 'linkCell',+// type: 'single',+// placeholder: { name: 'insertLink.placeholder2' },+// },+// {+// name: 'insertLink.linkTooltip',+// show: true,+// id: 'linkTooltip',+// type: 'single',+// placeholder: { name: 'insertLink.placeholder3' },+// },+// ],+// type: 'single',+// };+// }- setValue = (value: object, fn?: () => void) => {- this.setState(- (prevState) => ({- ...value,- }),- fn- );- };+// setValue = (value: object, fn?: () => void) => {+// this.setState(+// (prevState) => ({+// ...value,+// }),+// fn+// );+// };- setLocale() {- const locale = this._context.getLocale();- this.setState((prevState) => {- let { data } = prevState;- data.forEach((item) => {- item.label = locale.get(item.name);- if (item.children && item.children.length) {- item.children.forEach((ele) => {- ele.label = locale.get(ele.name);- });- }- if (item.placeholder) {- item.placeholder.label = locale.get(item.placeholder.name);- }- });+// setLocale() {+// const locale = this._context.getLocale();+// this.setState((prevState) => {+// let { data } = prevState;+// data.forEach((item) => {+// item.label = locale.get(item.name);+// if (item.children && item.children.length) {+// item.children.forEach((ele) => {+// ele.label = locale.get(ele.name);+// });+// }+// if (item.placeholder) {+// item.placeholder.label = locale.get(item.placeholder.name);+// }+// });- return {- data,- };- });- }+// return {+// data,+// };+// });+// }- changeLinkType = (e: Event) => {- const target = e.target as HTMLSelectElement;- let { data } = this.state;- const addressIndex = data.findIndex((item) => item.id === 'linkAddress');- const sheetIndex = data.findIndex((item) => item.id === 'linkSheet');- const cellIndex = data.findIndex((item) => item.id === 'linkCell');- if (target.value === 'external') {- data[addressIndex].show = true;- data[sheetIndex].show = false;- data[cellIndex].show = false;- } else {- data[addressIndex].show = false;- data[sheetIndex].show = true;- data[cellIndex].show = true;- }- this.setValue({ data });- };+// changeLinkType = (e: Event) => {+// const target = e.target as HTMLSelectElement;+// let { data } = this.state;+// const addressIndex = data.findIndex((item) => item.id === 'linkAddress');+// const sheetIndex = data.findIndex((item) => item.id === 'linkSheet');+// const cellIndex = data.findIndex((item) => item.id === 'linkCell');+// if (target.value === 'external') {+// data[addressIndex].show = true;+// data[sheetIndex].show = false;+// data[cellIndex].show = false;+// } else {+// data[addressIndex].show = false;+// data[sheetIndex].show = true;+// data[cellIndex].show = true;+// }+// this.setValue({ data });+// };- componentWillMount() {- this.setLocale();+// componentWillMount() {+// this.setLocale();- // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }+// // subscribe Locale change event+// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }- render(props: LinkContentProps, state: LinkContentState) {- const Input = this.Render.renderFunction('Input');- const { data } = state;- return (- <div className={styles.insertContent}>- {data.map((item) => {- if (!item.show) return <></>;- if (item.type === 'single') {- return (- <div>- <label for={item.id}>{item.label}:</label>- <Input id={item.id} type="text" placeholder={item.placeholder?.label}></Input>- </div>- );- }- return (- <div>- <label for={item.id}>{item.label}:</label>- <select- id={item.id}- onChange={(e) => {- item.onChange?.(e);- }}- >- {item.children?.map((ele) => (- <option value={ele.value}>{ele.label}</option>- ))}- </select>- </div>- );- })}- </div>- );- }-}+// render(props: LinkContentProps, state: LinkContentState) {+// const Input = this.Render.renderFunction('Input');+// const { data } = state;+// return (+// <div className={styles.insertContent}>+// {data.map((item) => {+// if (!item.show) return <></>;+// if (item.type === 'single') {+// return (+// <div>+// <label for={item.id}>{item.label}:</label>+// <Input id={item.id} type="text" placeholder={item.placeholder?.label}></Input>+// </div>+// );+// }+// return (+// <div>+// <label for={item.id}>{item.label}:</label>+// <select+// id={item.id}+// onChange={(e) => {+// item.onChange?.(e);+// }}+// >+// {item.children?.map((ele) => (+// <option value={ele.value}>{ele.label}</option>+// ))}+// </select>+// </div>+// );+// })}+// </div>+// );+// }+// }diff --git a/packages/sheets-plugin-operation/src/Domain/Copy.ts b/packages/sheets-plugin-operation/src/Domain/Copy.tsindex b26b0b24e5..aa19c3a73d 100644--- a/packages/sheets-plugin-operation/src/Domain/Copy.ts+++ b/packages/sheets-plugin-operation/src/Domain/Copy.ts@@ -1,4 +1,4 @@-import { SheetContext, PLUGIN_NAMES, Tools, handleJsonToDom, handleStyleToString, ObjectArray, IColumnData, IRowData } from '@univerjs/core';+import { SheetContext, PLUGIN_NAMES, Tools, handleJsonToDom, handleStyleToString } from '@univerjs/core';import { SheetPlugin, SelectionModel, SelectionControl } from '@univerjs/base-sheets';import { RightMenuProps, RightMenuItem } from '@univerjs/ui-plugin-sheets';import { Clipboard } from '@univerjs/base-ui';diff --git a/packages/sheets-plugin-pivot-table/src/UI/PivotTableButton.tsx b/packages/sheets-plugin-pivot-table/src/UI/PivotTableButton.tsxindex c607abeb4b..380344d969 100644--- a/packages/sheets-plugin-pivot-table/src/UI/PivotTableButton.tsx+++ b/packages/sheets-plugin-pivot-table/src/UI/PivotTableButton.tsx@@ -1,106 +1,106 @@-import { BaseComponentRender, BaseComponentSheet, Component, IToolbarItemProps } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { SheetPlugin } from '@univerjs/base-sheets';-import { PIVOT_TABLE_PLUGIN_NAME } from '../Const/PLUGIN_NAME';-import { IProps } from '../IData/IPivotTable';-import styles from './index.module.less';+// import { BaseComponentRender, BaseComponentSheet, Component, IToolbarItemProps } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { SheetPlugin } from '@univerjs/base-sheets';+// import { PIVOT_TABLE_PLUGIN_NAME } from '../Const/PLUGIN_NAME';+// import { IProps } from '../IData/IPivotTable';+// import styles from './index.module.less';-// Types for state-interface IState {- pivotTable: IToolbarItemProps;- // modalData: Array<ModalProps>;-}+// // Types for state+// interface IState {+// pivotTable: IToolbarItemProps;+// // modalData: Array<ModalProps>;+// }-export class PivotTableButton extends Component<IProps, IState> {- private _localeObserver: Nullable<Observer<Workbook>>;+// export class PivotTableButton extends Component<IProps, IState> {+// private _localeObserver: Nullable<Observer<Workbook>>;- Render: BaseComponentRender;+// Render: BaseComponentRender;- initialize(props: IProps) {- // super(props);- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();+// initialize(props: IProps) {+// // super(props);+// const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();- const PivotableIcon = this.Render.renderFunction('PivotableIcon');- const pivotTableState: IToolbarItemProps = {- locale: PIVOT_TABLE_PLUGIN_NAME,- type: 'single',- label: <PivotableIcon />,- show: true,- };- this.state = {- pivotTable: pivotTableState,- };- }+// const PivotableIcon = this.Render.renderFunction('PivotableIcon');+// const pivotTableState: IToolbarItemProps = {+// locale: PIVOT_TABLE_PLUGIN_NAME,+// type: 'single',+// label: <PivotableIcon />,+// show: true,+// };+// this.state = {+// pivotTable: pivotTableState,+// };+// }- /**- * init- */- componentWillMount() {- this.setLocale();+// /**+// * init+// */+// componentWillMount() {+// this.setLocale();- // subscribe Locale change event+// // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }+// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }- /**- * destory- */- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }+// /**+// * destory+// */+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }- /**- * set text by config setting and Locale message- */- setLocale() {- const locale = this._context.getLocale();- this.setState((prevState: IState) => {- let item = prevState.pivotTable;- // set current Locale string for tooltip- item.tooltip = locale.get(`${item.locale}Label`);- item.tooltipRight = locale.get(`${item.locale}RightLabel`);+// /**+// * set text by config setting and Locale message+// */+// setLocale() {+// const locale = this._context.getLocale();+// this.setState((prevState: IState) => {+// let item = prevState.pivotTable;+// // set current Locale string for tooltip+// item.tooltip = locale.get(`${item.locale}Label`);+// item.tooltipRight = locale.get(`${item.locale}RightLabel`);- // set current Locale string for select- item.children?.forEach((ele: IToolbarItemProps) => {- if (ele.locale) {- ele.label = locale.get(`${ele.locale}`);- }- });- item.label = typeof item.label === 'object' ? item.label : item.children![0].label;+// // set current Locale string for select+// item.children?.forEach((ele: IToolbarItemProps) => {+// if (ele.locale) {+// ele.label = locale.get(`${ele.locale}`);+// }+// });+// item.label = typeof item.label === 'object' ? item.label : item.children![0].label;- return {- pivotTable: item,- };- });- }+// return {+// pivotTable: item,+// };+// });+// }- showPivotTable = () => {};+// showPivotTable = () => {};- /**- * Render the component's HTML- *- * @returns {void}- */- render(props: IProps, state: IState) {- const Button = this.Render.renderFunction('Button');- const Tooltip = this.Render.renderFunction('Tooltip');- const { pivotTable } = state;- // Set Provider for entire Container- return (- <div className={styles.singleButton}>- <Tooltip title={pivotTable.tooltip!} placement={'bottom'}>- <Button type="text" onClick={this.showPivotTable}>- {pivotTable.label}- </Button>- </Tooltip>- </div>- );- }-}+// /**+// * Render the component's HTML+// *+// * @returns {void}+// */+// render(props: IProps, state: IState) {+// const Button = this.Render.renderFunction('Button');+// const Tooltip = this.Render.renderFunction('Tooltip');+// const { pivotTable } = state;+// // Set Provider for entire Container+// return (+// <div className={styles.singleButton}>+// <Tooltip title={pivotTable.tooltip!} placement={'bottom'}>+// <Button type="text" onClick={this.showPivotTable}>+// {pivotTable.label}+// </Button>+// </Tooltip>+// </div>+// );+// }+// }diff --git a/packages/sheets-plugin-print/src/UI/PrintMode/printInput.tsx b/packages/sheets-plugin-print/src/UI/PrintMode/printInput.tsxindex 7d9c83c516..d314c7470a 100644--- a/packages/sheets-plugin-print/src/UI/PrintMode/printInput.tsx+++ b/packages/sheets-plugin-print/src/UI/PrintMode/printInput.tsx@@ -1,38 +1,38 @@-import { Component, createRef } from '@univerjs/base-ui';-import styles from './index.module.less';+// import { Component, createRef } from '@univerjs/base-ui';+// import styles from './index.module.less';-interface IProps {- title: string;- onInput: (value: string) => void;-}-interface IState {- inputFocus: boolean;-}+// interface IProps {+// title: string;+// onInput: (value: string) => void;+// }+// interface IState {+// inputFocus: boolean;+// }-class PrintInput extends Component<IProps, IState> {- initialize(props: IProps) {- // super();- this.state = {- inputFocus: false,- };- }+// class PrintInput extends Component<IProps, IState> {+// initialize(props: IProps) {+// // super();+// this.state = {+// inputFocus: false,+// };+// }- inputRef = createRef();+// inputRef = createRef();- onInput() {- const value = this.inputRef.current.value;+// onInput() {+// const value = this.inputRef.current.value;- this.props.onInput(value);- }+// this.props.onInput(value);+// }- render() {- return (- <div className={styles.printInput}>- <span>{this.props.title}:</span>- <input ref={this.inputRef} onInput={this.onInput.bind(this)} type="text" />- </div>- );- }-}+// render() {+// return (+// <div className={styles.printInput}>+// <span>{this.props.title}:</span>+// <input ref={this.inputRef} onInput={this.onInput.bind(this)} type="text" />+// </div>+// );+// }+// }-export { PrintInput };+// export { PrintInput };diff --git a/packages/sheets-plugin-print/src/UI/PrintMode/printMode.tsx b/packages/sheets-plugin-print/src/UI/PrintMode/printMode.tsxindex 1a83ac2e0a..d7d63bf24e 100644--- a/packages/sheets-plugin-print/src/UI/PrintMode/printMode.tsx+++ b/packages/sheets-plugin-print/src/UI/PrintMode/printMode.tsx@@ -1,392 +1,392 @@-import {- BaseButtonProps,- BaseCheckboxGroupProps,- BaseCollapseProps,- BaseComponentSheet,- BasePanelProps,- BaseRadioGroupProps,- BaseRadioIProps,- Component,- FunctionComponent,-} from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { IConfig } from '../../IData';-import styles from './index.module.less';-import { PrintInput } from './printInput';-import { PrintSelect } from './printSelsct';+// import {+// BaseButtonProps,+// BaseCheckboxGroupProps,+// BaseCollapseProps,+// BaseComponentSheet,+// BasePanelProps,+// BaseRadioGroupProps,+// BaseRadioIProps,+// Component,+// FunctionComponent,+// } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { IConfig } from '../../IData';+// import styles from './index.module.less';+// import { PrintInput } from './printInput';+// import { PrintSelect } from './printSelsct';-interface Options {- key: number;- value: string;-}-interface IProps {- visible: boolean;- onCancel: () => void;- config: IConfig;-}-interface IState {- active: string | number;- options: Options;- printSheet: any;- printPaperSize: any;- printZoom: any;- printMargin: any;- printPageOrder: any;- printHorizontal: any;- printVertical: any;- paperSizeCustom: boolean;- locale: any;-}+// interface Options {+// key: number;+// value: string;+// }+// interface IProps {+// visible: boolean;+// onCancel: () => void;+// config: IConfig;+// }+// interface IState {+// active: string | number;+// options: Options;+// printSheet: any;+// printPaperSize: any;+// printZoom: any;+// printMargin: any;+// printPageOrder: any;+// printHorizontal: any;+// printVertical: any;+// paperSizeCustom: boolean;+// locale: any;+// }-class PrintMode extends Component<IProps, IState> {- // printModeRef = createRef();+// class PrintMode extends Component<IProps, IState> {+// // printModeRef = createRef();- private _localeObserver: Nullable<Observer<Workbook>>;+// private _localeObserver: Nullable<Observer<Workbook>>;- Button: FunctionComponent<BaseButtonProps>;+// Button: FunctionComponent<BaseButtonProps>;- CheckboxGroup: FunctionComponent<BaseCheckboxGroupProps>;+// CheckboxGroup: FunctionComponent<BaseCheckboxGroupProps>;- Collapse: FunctionComponent<BaseCollapseProps>;+// Collapse: FunctionComponent<BaseCollapseProps>;- Panel: FunctionComponent<BasePanelProps>;+// Panel: FunctionComponent<BasePanelProps>;- Radio: FunctionComponent<BaseRadioIProps>;+// Radio: FunctionComponent<BaseRadioIProps>;- RadioGroup: FunctionComponent<BaseRadioGroupProps>;+// RadioGroup: FunctionComponent<BaseRadioGroupProps>;- initialize(props: IProps) {- const component = this.props.config.context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- const render = component.getComponentRender();- this.Button = render.renderFunction('Button');- this.CheckboxGroup = render.renderFunction('CheckboxGroup');- this.Collapse = render.renderFunction('Collapse');- this.Panel = render.renderFunction('Panel');- this.Radio = render.renderFunction('Radio');- this.RadioGroup = render.renderFunction('RadioGroup');+// initialize(props: IProps) {+// const component = this.props.config.context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// const render = component.getComponentRender();+// this.Button = render.renderFunction('Button');+// this.CheckboxGroup = render.renderFunction('CheckboxGroup');+// this.Collapse = render.renderFunction('Collapse');+// this.Panel = render.renderFunction('Panel');+// this.Radio = render.renderFunction('Radio');+// this.RadioGroup = render.renderFunction('RadioGroup');- this.state = {- active: '1',- options: { key: 1, value: '111' },- paperSizeCustom: false,- printSheet: [- {- name: 'print.menuItemPrint',- label: '当前工作表',- },- ],- printPaperSize: [- {- name: 'print.menuItemPrint',- label: '信纸(21.6厘米x27.9厘米)',- },- {- name: 'print.menuItemPrint',- label: '小报(27.9厘米x43.2厘米)',- },- {- name: 'print.menuItemPrint',- label: '法律专用纸(21.6厘米x35.6厘米)',- },- {- name: 'print.menuItemPrint',- label: '报表(14.0厘米x21.6厘米)',- },- {- name: 'print.menuItemPrint',- label: '行政公文纸(18.4厘米x26.7厘米)',- },- {- name: 'print.menuItemPrint',- label: '对折纸(18.4厘米x26.7厘米)',- },- {- name: 'print.menuItemPrint',- label: 'A3(29.7厘米x42.0厘米)',- },- {- name: 'print.menuItemPrint',- label: 'A4(21.0厘米x29.7厘米)',- },- {- name: 'print.menuItemPrint',- label: 'A5(14.8厘米x21.0厘米)',- },- {- name: 'print.menuItemPrint',- label: 'B4(25.0厘米x35.3厘米)',- },- {- name: 'print.menuItemPrint',- label: 'B5(17.6厘米x25.0厘米)',- },- {- name: 'print.custom',- label: '自定义',- },- ],- printZoom: [- {- name: 'print.menuItemPrint',- label: '正常(100%)',- },- {- name: 'print.menuItemPrint',- label: '适合宽度',- },- {- name: 'print.menuItemPrint',- label: '适合高度',- },- {- name: 'print.menuItemPrint',- label: '适合页面大小',- },- ],- printMargin: [- {- name: 'print.menuItemPrint',- label: '正常',- },- {- name: 'print.menuItemPrint',- label: '窄',- },- {- name: 'print.menuItemPrint',- label: '宽',- },- ],- printPageOrder: [- {- name: 'print.menuItemPrint',- label: '先往下,再翻页',- },- {- name: 'print.menuItemPrint',- label: '先翻页,再往下',- },- ],- printHorizontal: [- {- name: 'print.menuItemPrint',- label: '水平居中',- },- {- name: 'print.menuItemPrint',- label: '左对齐',- },- {- name: 'print.menuItemPrint',- label: '右对齐',- },- ],- printVertical: [- {- name: 'print.menuItemPrint',- label: '顶部对齐',- },- {- name: 'print.menuItemPrint',- label: '底部对齐',- },- {- name: 'print.menuItemPrint',- label: '垂直居中',- },- ],- locale: null,- };- }+// this.state = {+// active: '1',+// options: { key: 1, value: '111' },+// paperSizeCustom: false,+// printSheet: [+// {+// name: 'print.menuItemPrint',+// label: '当前工作表',+// },+// ],+// printPaperSize: [+// {+// name: 'print.menuItemPrint',+// label: '信纸(21.6厘米x27.9厘米)',+// },+// {+// name: 'print.menuItemPrint',+// label: '小报(27.9厘米x43.2厘米)',+// },+// {+// name: 'print.menuItemPrint',+// label: '法律专用纸(21.6厘米x35.6厘米)',+// },+// {+// name: 'print.menuItemPrint',+// label: '报表(14.0厘米x21.6厘米)',+// },+// {+// name: 'print.menuItemPrint',+// label: '行政公文纸(18.4厘米x26.7厘米)',+// },+// {+// name: 'print.menuItemPrint',+// label: '对折纸(18.4厘米x26.7厘米)',+// },+// {+// name: 'print.menuItemPrint',+// label: 'A3(29.7厘米x42.0厘米)',+// },+// {+// name: 'print.menuItemPrint',+// label: 'A4(21.0厘米x29.7厘米)',+// },+// {+// name: 'print.menuItemPrint',+// label: 'A5(14.8厘米x21.0厘米)',+// },+// {+// name: 'print.menuItemPrint',+// label: 'B4(25.0厘米x35.3厘米)',+// },+// {+// name: 'print.menuItemPrint',+// label: 'B5(17.6厘米x25.0厘米)',+// },+// {+// name: 'print.custom',+// label: '自定义',+// },+// ],+// printZoom: [+// {+// name: 'print.menuItemPrint',+// label: '正常(100%)',+// },+// {+// name: 'print.menuItemPrint',+// label: '适合宽度',+// },+// {+// name: 'print.menuItemPrint',+// label: '适合高度',+// },+// {+// name: 'print.menuItemPrint',+// label: '适合页面大小',+// },+// ],+// printMargin: [+// {+// name: 'print.menuItemPrint',+// label: '正常',+// },+// {+// name: 'print.menuItemPrint',+// label: '窄',+// },+// {+// name: 'print.menuItemPrint',+// label: '宽',+// },+// ],+// printPageOrder: [+// {+// name: 'print.menuItemPrint',+// label: '先往下,再翻页',+// },+// {+// name: 'print.menuItemPrint',+// label: '先翻页,再往下',+// },+// ],+// printHorizontal: [+// {+// name: 'print.menuItemPrint',+// label: '水平居中',+// },+// {+// name: 'print.menuItemPrint',+// label: '左对齐',+// },+// {+// name: 'print.menuItemPrint',+// label: '右对齐',+// },+// ],+// printVertical: [+// {+// name: 'print.menuItemPrint',+// label: '顶部对齐',+// },+// {+// name: 'print.menuItemPrint',+// label: '底部对齐',+// },+// {+// name: 'print.menuItemPrint',+// label: '垂直居中',+// },+// ],+// locale: null,+// };+// }- componentWillMount() {- this.setLocale();+// componentWillMount() {+// this.setLocale();- // subscribe Locale change event+// // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }+// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }- /**- * destory- */- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }+// /**+// * destory+// */+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }- setLocale() {- const locale = this._context.getLocale().get('print');- this.setState({ locale });- }+// setLocale() {+// const locale = this._context.getLocale().get('print');+// this.setState({ locale });+// }- onChange(val: string | number) {- this.setState({- active: val,- });- }+// onChange(val: string | number) {+// this.setState({+// active: val,+// });+// }- onReturn() {- this.props.onCancel();- }+// onReturn() {+// this.props.onCancel();+// }- render() {- const { Button, CheckboxGroup, Collapse, Panel, Radio, RadioGroup } = this;- const { locale } = this.state.locale;- return (- <>- {this.props.visible ? (- <div className={styles.printMode}>- <div className={styles.printHeader}>- <div className={styles.printHeaderTitle}>{locale.printSettings}</div>- <div className={styles.printHeaderBtn}>- <Button className={styles.printReturn} onClick={this.onReturn.bind(this)}>- {locale.cancel}- </Button>- <Button type="primary">{locale.next}</Button>- </div>- </div>- <div className={styles.printContainer}>- <div className={styles.printLeft}>{locale.preview}</div>- <div className={styles.printSide}>- <PrintSelect config={this.props.config} title={locale.print} onChange={(value) => {}} children={this.state.printSheet} />- <PrintSelect- config={this.props.config}- title={locale.paperSize}- onChange={(value) => {- console.log(value);- switch (value.name) {- case 'print.custom':- this.setState({- paperSizeCustom: true,- });- break;+// render() {+// const { Button, CheckboxGroup, Collapse, Panel, Radio, RadioGroup } = this;+// const { locale } = this.state.locale;+// return (+// <>+// {this.props.visible ? (+// <div className={styles.printMode}>+// <div className={styles.printHeader}>+// <div className={styles.printHeaderTitle}>{locale.printSettings}</div>+// <div className={styles.printHeaderBtn}>+// <Button className={styles.printReturn} onClick={this.onReturn.bind(this)}>+// {locale.cancel}+// </Button>+// <Button type="primary">{locale.next}</Button>+// </div>+// </div>+// <div className={styles.printContainer}>+// <div className={styles.printLeft}>{locale.preview}</div>+// <div className={styles.printSide}>+// <PrintSelect config={this.props.config} title={locale.print} onChange={(value) => {}} children={this.state.printSheet} />+// <PrintSelect+// config={this.props.config}+// title={locale.paperSize}+// onChange={(value) => {+// console.log(value);+// switch (value.name) {+// case 'print.custom':+// this.setState({+// paperSizeCustom: true,+// });+// break;- default:- this.setState({- paperSizeCustom: false,- });- break;- }- }}- children={this.state.printPaperSize}- />- {this.state.paperSizeCustom ? (- <div className={styles.printInputGroup}>- <PrintInput- title={locale.width}- onInput={(value) => {- console.log(value);- }}- ></PrintInput>- <PrintInput- title={locale.height}- onInput={(value) => {- console.log(value);- }}- ></PrintInput>- </div>- ) : null}- <div className={styles.printRadio}>- <div className={styles.printSelectTitle}>{locale.pageOrientation}</div>- <RadioGroup className={styles.printRadioGroup} onChange={this.onChange.bind(this)} active={this.state.active}>- <Radio value="1">11111</Radio>- <Radio value="2">22222</Radio>- </RadioGroup>- </div>- <PrintSelect config={this.props.config} title={locale.zoom} onChange={() => {}} children={this.state.printZoom} />- <PrintSelect config={this.props.config} title={locale.margin} onChange={() => {}} children={this.state.printMargin} />- <Collapse>- <Panel header={locale.formatOptions}>- <>- <CheckboxGroup- options={[- {- name: '',- label: '显示网格线',- value: '1',- },- {- name: '',- label: '显示备注',- value: '2',- },- ]}- onChange={(value) => {}}- ></CheckboxGroup>- <PrintSelect config={this.props.config} title={locale.pageOrder} onChange={() => {}} children={this.state.printPageOrder} />- <div className={styles.printSideTitle}>{locale.alignment}</div>- <div style={{ width: '50%' }}>- <PrintSelect config={this.props.config} title={locale.level} onChange={() => {}} children={this.state.printHorizontal} />- <PrintSelect config={this.props.config} title={locale.vertical} onChange={() => {}} children={this.state.printVertical} />- </div>- </>- </Panel>- <Panel header={locale.headerAndFooter}>- <>- <CheckboxGroup- options={[- {- name: '',- label: '页码',- value: '1',- },- {- name: '',- label: '工作簿标题',- value: '2',- },- {- name: '',- label: '工作表名称',- value: '3',- },- {- name: '',- label: '当前日期',- value: '4',- },- {- name: '',- label: '当前时间',- value: '5',- },- ]}- onChange={(value) => {}}- ></CheckboxGroup>- <div className={styles.printSideTitle}>{locale.headers}</div>- <div className={styles.printSideTitle}>转到“查看”>“冻结”可选择要在所有页面重复的行/列</div>- <CheckboxGroup- options={[- {- name: '',- label: '重复冻结行',- value: '1',- disabled: true,- },- {- name: '',- label: '重复冻结列',- value: '2',- disabled: true,- },- ]}- onChange={(value) => {}}- ></CheckboxGroup>- </>- </Panel>- </Collapse>- </div>- </div>- </div>- ) : null}- </>- );- }-}+// default:+// this.setState({+// paperSizeCustom: false,+// });+// break;+// }+// }}+// children={this.state.printPaperSize}+// />+// {this.state.paperSizeCustom ? (+// <div className={styles.printInputGroup}>+// <PrintInput+// title={locale.width}+// onInput={(value) => {+// console.log(value);+// }}+// ></PrintInput>+// <PrintInput+// title={locale.height}+// onInput={(value) => {+// console.log(value);+// }}+// ></PrintInput>+// </div>+// ) : null}+// <div className={styles.printRadio}>+// <div className={styles.printSelectTitle}>{locale.pageOrientation}</div>+// <RadioGroup className={styles.printRadioGroup} onChange={this.onChange.bind(this)} active={this.state.active}>+// <Radio value="1">11111</Radio>+// <Radio value="2">22222</Radio>+// </RadioGroup>+// </div>+// <PrintSelect config={this.props.config} title={locale.zoom} onChange={() => {}} children={this.state.printZoom} />+// <PrintSelect config={this.props.config} title={locale.margin} onChange={() => {}} children={this.state.printMargin} />+// <Collapse>+// <Panel header={locale.formatOptions}>+// <>+// <CheckboxGroup+// options={[+// {+// name: '',+// label: '显示网格线',+// value: '1',+// },+// {+// name: '',+// label: '显示备注',+// value: '2',+// },+// ]}+// onChange={(value) => {}}+// ></CheckboxGroup>+// <PrintSelect config={this.props.config} title={locale.pageOrder} onChange={() => {}} children={this.state.printPageOrder} />+// <div className={styles.printSideTitle}>{locale.alignment}</div>+// <div style={{ width: '50%' }}>+// <PrintSelect config={this.props.config} title={locale.level} onChange={() => {}} children={this.state.printHorizontal} />+// <PrintSelect config={this.props.config} title={locale.vertical} onChange={() => {}} children={this.state.printVertical} />+// </div>+// </>+// </Panel>+// <Panel header={locale.headerAndFooter}>+// <>+// <CheckboxGroup+// options={[+// {+// name: '',+// label: '页码',+// value: '1',+// },+// {+// name: '',+// label: '工作簿标题',+// value: '2',+// },+// {+// name: '',+// label: '工作表名称',+// value: '3',+// },+// {+// name: '',+// label: '当前日期',+// value: '4',+// },+// {+// name: '',+// label: '当前时间',+// value: '5',+// },+// ]}+// onChange={(value) => {}}+// ></CheckboxGroup>+// <div className={styles.printSideTitle}>{locale.headers}</div>+// <div className={styles.printSideTitle}>转到“查看”>“冻结”可选择要在所有页面重复的行/列</div>+// <CheckboxGroup+// options={[+// {+// name: '',+// label: '重复冻结行',+// value: '1',+// disabled: true,+// },+// {+// name: '',+// label: '重复冻结列',+// value: '2',+// disabled: true,+// },+// ]}+// onChange={(value) => {}}+// ></CheckboxGroup>+// </>+// </Panel>+// </Collapse>+// </div>+// </div>+// </div>+// ) : null}+// </>+// );+// }+// }-export { PrintMode };+// export { PrintMode };diff --git a/packages/sheets-plugin-print/src/UI/PrintMode/printSelsct.tsx b/packages/sheets-plugin-print/src/UI/PrintMode/printSelsct.tsxindex b651ae3146..1549dce3e9 100644--- a/packages/sheets-plugin-print/src/UI/PrintMode/printSelsct.tsx+++ b/packages/sheets-plugin-print/src/UI/PrintMode/printSelsct.tsx@@ -1,113 +1,113 @@-import { BaseComponentSheet, BaseIconProps, BaseUlProps, Component, createRef, FunctionComponent } from '@univerjs/base-ui';-import { IConfig } from '../../IData';-import styles from './index.module.less';--interface IProps {- title: string;- isInput?: boolean;- children: any;- onChange: (value: any) => void;- config: IConfig;-}-interface IState {- active: any;- inputShow: boolean;-}--let time = 100;-let timeOut: ReturnType<typeof setTimeout> | null = null;-class PrintSelect extends Component<IProps, IState> {- NextIcon: FunctionComponent<BaseIconProps>;-- Ul: FunctionComponent<BaseUlProps>;-- initialize(props: IProps) {- // super();- const component = this.props.config.context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- const render = component.getComponentRender();- this.NextIcon = render.renderFunction('NextIcon');- this.Ul = render.renderFunction('Ul');- this.state = {- active: {},- inputShow: false,- };- }-- ref = createRef();-- inputRef = createRef();-- onDblClick() {- clearTimeout(timeOut!);- if (!this.props.isInput) return;- this.setState({- inputShow: true,- });- }-- /**- * Listen for click events- * @eventProperty- */- handleClick(...args: any[]) {- this.hideSelect(args[0]);- const { item } = args[1];- this.props.onChange(item);- this.setState({- active: item,- });- }-- // 显示子组件- showSelect = (e: MouseEvent) => {- if (this.state.inputShow) return;- clearTimeout(timeOut!);- timeOut = setTimeout(() => {- e.stopImmediatePropagation();- const current = this.ref.current;- if (current) current.showSelect();- }, time);-- // 点击外部隐藏子组件- document.addEventListener('click', this.hideSelect, true);- };-- // 隐藏子组件- hideSelect = (e: MouseEvent) => {- if (this.state.inputShow && this.inputRef.current.contains(e.target)) return;- const current = this.ref.current;-- if (current) {- current.hideSelect(e);- this.setState({- inputShow: false,- });- }-- document.removeEventListener('click', this.hideSelect, true);- };-- componentWillMount() {- this.setState({- active: this.props.children[0],- });- }-- render() {- const { NextIcon, Ul } = this;- return (- <div className={styles.printSelect}>- <div className={styles.printSelectTitle}>{this.props.title}</div>- <div className={styles.printSelector} onClick={this.showSelect.bind(this)} onDblClick={this.onDblClick.bind(this)}>- <span className={styles.printSelectorLabel}>- {this.state.inputShow ? <input type="text" className={styles.printSelectInput} ref={this.inputRef} /> : <span>{this.state.active.label}</span>}- </span>- <NextIcon />- <Ul children={this.props.children} onClick={this.handleClick.bind(this)} ref={this.ref}></Ul>- </div>- </div>- );- }-}--export { PrintSelect };+// import { BaseComponentSheet, BaseIconProps, BaseUlProps, Component, createRef, FunctionComponent } from '@univerjs/base-ui';+// import { IConfig } from '../../IData';+// import styles from './index.module.less';++// interface IProps {+// title: string;+// isInput?: boolean;+// children: any;+// onChange: (value: any) => void;+// config: IConfig;+// }+// interface IState {+// active: any;+// inputShow: boolean;+// }++// let time = 100;+// let timeOut: ReturnType<typeof setTimeout> | null = null;+// class PrintSelect extends Component<IProps, IState> {+// NextIcon: FunctionComponent<BaseIconProps>;++// Ul: FunctionComponent<BaseUlProps>;++// initialize(props: IProps) {+// // super();+// const component = this.props.config.context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// const render = component.getComponentRender();+// this.NextIcon = render.renderFunction('NextIcon');+// this.Ul = render.renderFunction('Ul');+// this.state = {+// active: {},+// inputShow: false,+// };+// }++// ref = createRef();++// inputRef = createRef();++// onDblClick() {+// clearTimeout(timeOut!);+// if (!this.props.isInput) return;+// this.setState({+// inputShow: true,+// });+// }++// /**+// * Listen for click events+// * @eventProperty+// */+// handleClick(...args: any[]) {+// this.hideSelect(args[0]);+// const { item } = args[1];+// this.props.onChange(item);+// this.setState({+// active: item,+// });+// }++// // 显示子组件+// showSelect = (e: MouseEvent) => {+// if (this.state.inputShow) return;+// clearTimeout(timeOut!);+// timeOut = setTimeout(() => {+// e.stopImmediatePropagation();+// const current = this.ref.current;+// if (current) current.showSelect();+// }, time);++// // 点击外部隐藏子组件+// document.addEventListener('click', this.hideSelect, true);+// };++// // 隐藏子组件+// hideSelect = (e: MouseEvent) => {+// if (this.state.inputShow && this.inputRef.current.contains(e.target)) return;+// const current = this.ref.current;++// if (current) {+// current.hideSelect(e);+// this.setState({+// inputShow: false,+// });+// }++// document.removeEventListener('click', this.hideSelect, true);+// };++// componentWillMount() {+// this.setState({+// active: this.props.children[0],+// });+// }++// render() {+// const { NextIcon, Ul } = this;+// return (+// <div className={styles.printSelect}>+// <div className={styles.printSelectTitle}>{this.props.title}</div>+// <div className={styles.printSelector} onClick={this.showSelect.bind(this)} onDblClick={this.onDblClick.bind(this)}>+// <span className={styles.printSelectorLabel}>+// {this.state.inputShow ? <input type="text" className={styles.printSelectInput} ref={this.inputRef} /> : <span>{this.state.active.label}</span>}+// </span>+// <NextIcon />+// <Ul children={this.props.children} onClick={this.handleClick.bind(this)} ref={this.ref}></Ul>+// </div>+// </div>+// );+// }+// }++// export { PrintSelect };diff --git a/packages/sheets-plugin-screenshot/src/UI/ScreenshotButton.tsx b/packages/sheets-plugin-screenshot/src/UI/ScreenshotButton.tsxindex cc8f86fdcc..6c0e5ece28 100644--- a/packages/sheets-plugin-screenshot/src/UI/ScreenshotButton.tsx+++ b/packages/sheets-plugin-screenshot/src/UI/ScreenshotButton.tsx@@ -1,155 +1,155 @@-import { BaseComponentRender, BaseComponentSheet, Component, createRef, IToolbarItemProps, ModalProps } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { IProps } from '../IData/IScreenshot';-import styles from './index.module.less';--// Types for state-interface IState {- screenshot: IToolbarItemProps;- modalData: ModalProps[];-}-// const screenshot: IToolbarItemProps = {-// name: 'screenshot.screenshotLabel',-// type: 'single',-// icon: <Icon.View.ScreenshotIcon />,-// show: true,-// };--export class ScreenshotButton extends Component<IProps, IState> {- private _localeObserver: Nullable<Observer<Workbook>>;-- ref = createRef();-- Render: BaseComponentRender;-- initialize(props: IProps) {- // super(props);-- const component = this.props.config.context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();-- const ScreenshotIcon = this.Render.renderFunction('ScreenshotIcon');-- this.state = {- screenshot: {- locale: 'screenshot.screenshotLabel',- type: 'single',- icon: <ScreenshotIcon />,- show: true,- },- modalData: [- {- locale: 'screenshot.screenshotTipSuccess',- show: false,- group: [- {- locale: 'screenshot.downLoadBtn',- type: 'primary',- },- {- locale: 'screenshot.downLoadCopy',- type: 'primary',- },- {- locale: 'screenshot.downLoadClose',- },- ],- onCancel: () => this.showModal(0, false),- },- {- locale: 'screenshot.screenshotTipTitle',- show: false,- children: 'screenshot.screenshotTipHasMulti',- group: [- {- locale: 'screenshot.downLoadClose',- },- ],- },- ],- };- }-- /**- * init- */- componentWillMount() {- this.setLocale();-- // subscribe Locale change event-- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }-- /**- * destory- */- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }-- /**- * set text by config setting and Locale message- */- setLocale() {- const locale = this._context.getLocale();- this.setState((prevState: IState) => {- let item = prevState.screenshot;- // set current Locale string for tooltip- item.tooltip = locale.get(`${item.locale}`);-- let modal = prevState.modalData;- if (modal.length) {- modal.forEach((ele) => {- ele.title = locale.get(ele.locale!);- if (ele.group && ele.group.length) {- ele.group.forEach((node) => {- node.label = locale.get(node.locale!);- });- }- });- }-- return {- screenshot: item,- modalData: modal,- };- });- }-- showModal = (index: number, isShow: boolean) => {- let { modalData } = this.state;- modalData[index].show = isShow;- this.setState((prevState) => ({- modalData,- }));- };-- /**- * Render the component's HTML- *- * @returns {void}- */- render(props: IProps, state: IState) {- const Button = this.Render.renderFunction('Button');- const Modal = this.Render.renderFunction('Modal');- const { screenshot, modalData } = state;- // Set Provider for entire Container- return (- <div className={styles.singleButton}>- <Button type="text" onClick={() => this.showModal(0, true)}>- {screenshot.icon}- </Button>- {modalData.map((item) => {- if (!item.show) return;- return <Modal visible={item.show} title={item.title} group={item.group} onCancel={item.onCancel}></Modal>;- })}- </div>- );- }-}+// import { BaseComponentRender, BaseComponentSheet, Component, createRef, IToolbarItemProps, ModalProps } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { IProps } from '../IData/IScreenshot';+// import styles from './index.module.less';++// // Types for state+// interface IState {+// screenshot: IToolbarItemProps;+// modalData: ModalProps[];+// }+// // const screenshot: IToolbarItemProps = {+// // name: 'screenshot.screenshotLabel',+// // type: 'single',+// // icon: <Icon.View.ScreenshotIcon />,+// // show: true,+// // };++// export class ScreenshotButton extends Component<IProps, IState> {+// private _localeObserver: Nullable<Observer<Workbook>>;++// ref = createRef();++// Render: BaseComponentRender;++// initialize(props: IProps) {+// // super(props);++// const component = this.props.config.context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();++// const ScreenshotIcon = this.Render.renderFunction('ScreenshotIcon');++// this.state = {+// screenshot: {+// locale: 'screenshot.screenshotLabel',+// type: 'single',+// icon: <ScreenshotIcon />,+// show: true,+// },+// modalData: [+// {+// locale: 'screenshot.screenshotTipSuccess',+// show: false,+// group: [+// {+// locale: 'screenshot.downLoadBtn',+// type: 'primary',+// },+// {+// locale: 'screenshot.downLoadCopy',+// type: 'primary',+// },+// {+// locale: 'screenshot.downLoadClose',+// },+// ],+// onCancel: () => this.showModal(0, false),+// },+// {+// locale: 'screenshot.screenshotTipTitle',+// show: false,+// children: 'screenshot.screenshotTipHasMulti',+// group: [+// {+// locale: 'screenshot.downLoadClose',+// },+// ],+// },+// ],+// };+// }++// /**+// * init+// */+// componentWillMount() {+// this.setLocale();++// // subscribe Locale change event++// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }++// /**+// * destory+// */+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }++// /**+// * set text by config setting and Locale message+// */+// setLocale() {+// const locale = this._context.getLocale();+// this.setState((prevState: IState) => {+// let item = prevState.screenshot;+// // set current Locale string for tooltip+// item.tooltip = locale.get(`${item.locale}`);++// let modal = prevState.modalData;+// if (modal.length) {+// modal.forEach((ele) => {+// ele.title = locale.get(ele.locale!);+// if (ele.group && ele.group.length) {+// ele.group.forEach((node) => {+// node.label = locale.get(node.locale!);+// });+// }+// });+// }++// return {+// screenshot: item,+// modalData: modal,+// };+// });+// }++// showModal = (index: number, isShow: boolean) => {+// let { modalData } = this.state;+// modalData[index].show = isShow;+// this.setState((prevState) => ({+// modalData,+// }));+// };++// /**+// * Render the component's HTML+// *+// * @returns {void}+// */+// render(props: IProps, state: IState) {+// const Button = this.Render.renderFunction('Button');+// const Modal = this.Render.renderFunction('Modal');+// const { screenshot, modalData } = state;+// // Set Provider for entire Container+// return (+// <div className={styles.singleButton}>+// <Button type="text" onClick={() => this.showModal(0, true)}>+// {screenshot.icon}+// </Button>+// {modalData.map((item) => {+// if (!item.show) return;+// return <Modal visible={item.show} title={item.title} group={item.group} onCancel={item.onCancel}></Modal>;+// })}+// </div>+// );+// }+// }diff --git a/packages/sheets-plugin-split-column/src/UI/SplitColumnButton.tsx b/packages/sheets-plugin-split-column/src/UI/SplitColumnButton.tsxindex 1d16dfd1e0..e96bb0cfa8 100644--- a/packages/sheets-plugin-split-column/src/UI/SplitColumnButton.tsx+++ b/packages/sheets-plugin-split-column/src/UI/SplitColumnButton.tsx@@ -1,178 +1,178 @@-import { BaseComponentRender, BaseComponentSheet, Component, IToolbarItemProps, ModalProps } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { SheetPlugin } from '@univerjs/base-sheets';-import { IProps } from '../IData/ISplitColumn';-import styles from './index.module.less';-import { SplitColumnContent } from './SplitColumnContent';--// Types for state-interface IState {- splitColumn: IToolbarItemProps;- modalData: ModalProps[];- notice: Notice[];-}--type Notice = {- locale: string;- label?: string;-};--export class SplitColumnButton extends Component<IProps, IState> {- private _localeObserver: Nullable<Observer<Workbook>>;-- Render: BaseComponentRender;-- initialize(props: IProps) {- // super(props);- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();- const DivideIcon = this.Render.renderFunction('DivideIcon');-- const splitColumn: IToolbarItemProps = {- locale: 'splitColumn.splitColumnLabel',- type: 'single',- label: <DivideIcon />,- show: true,- };-- this.state = {- splitColumn,- notice: [- {- locale: 'splitColumn.tipNoMulti',- },- {- locale: 'splitColumn.tipNoMultiColumn',- },- ],- modalData: [- {- locale: 'splitColumn.splitTextTitle',- show: false,- group: [- {- locale: 'button.confirm',- type: 'primary',- },- {- locale: 'button.cancel',- },- ],- children: <SplitColumnContent config={this.props.config} />,- onCancel: () => {- this.showModal(0, false);- },- },- {- show: false,- group: [- {- locale: 'button.close',- },- ],- },- {- show: false,- group: [- {- locale: 'button.close',- },- ],- },- ],- };- }-- /**- * init- */- componentWillMount() {- this.setLocale();-- // subscribe Locale change event-- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }-- /**- * destory- */- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }-- /**- * set text by config setting and Locale message- */- setLocale() {- const locale = this._context.getLocale();- this.setState((prevState: IState) => {- let item = prevState.splitColumn;- // set current Locale string for tooltip- item.tooltip = locale.get(`${item.locale}`);-- let notice = prevState.notice;- notice.forEach((ele) => {- ele.label = locale.get(ele.locale);- });-- let modalData = prevState.modalData;- modalData.forEach((ele, index) => {- ele.title = locale.get(ele.locale!);- if (ele.group && ele.group.length) {- ele.group.forEach((node) => {- node.label = locale.get(node.locale!);- });- }- if (index === 1) {- ele.children = <p>{notice[0].label}</p>;- }- if (index === 2) {- ele.children = <p>{notice[1].label}</p>;- }- });-- return {- splitColumn: item,- modalData,- notice,- };- });- }-- showModal = (index: number, isShow: boolean) => {- let { modalData } = this.state;- modalData[index].show = isShow;- this.setState((prevState) => ({- modalData,- }));- };-- /**- * Render the component's HTML- *- * @returns {void}- */- render(props: IProps, state: IState) {- const Button = this.Render.renderFunction('Button');- const Modal = this.Render.renderFunction('Modal');- const { splitColumn, modalData } = state;- // Set Provider for entire Container- return (- <div className={styles.singleButton}>- <Button type="text" onClick={() => this.showModal(0, true)}>- {splitColumn.label}- </Button>- {modalData.map((item) => {- if (!item.show) return;- return <Modal visible={item.show} onCancel={item.onCancel} title={item.title} group={item.group} children={item.children}></Modal>;- })}- </div>- );- }-}+// import { BaseComponentRender, BaseComponentSheet, Component, IToolbarItemProps, ModalProps } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { SheetPlugin } from '@univerjs/base-sheets';+// import { IProps } from '../IData/ISplitColumn';+// import styles from './index.module.less';+// import { SplitColumnContent } from './SplitColumnContent';++// // Types for state+// interface IState {+// splitColumn: IToolbarItemProps;+// modalData: ModalProps[];+// notice: Notice[];+// }++// type Notice = {+// locale: string;+// label?: string;+// };++// export class SplitColumnButton extends Component<IProps, IState> {+// private _localeObserver: Nullable<Observer<Workbook>>;++// Render: BaseComponentRender;++// initialize(props: IProps) {+// // super(props);+// const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();+// const DivideIcon = this.Render.renderFunction('DivideIcon');++// const splitColumn: IToolbarItemProps = {+// locale: 'splitColumn.splitColumnLabel',+// type: 'single',+// label: <DivideIcon />,+// show: true,+// };++// this.state = {+// splitColumn,+// notice: [+// {+// locale: 'splitColumn.tipNoMulti',+// },+// {+// locale: 'splitColumn.tipNoMultiColumn',+// },+// ],+// modalData: [+// {+// locale: 'splitColumn.splitTextTitle',+// show: false,+// group: [+// {+// locale: 'button.confirm',+// type: 'primary',+// },+// {+// locale: 'button.cancel',+// },+// ],+// children: <SplitColumnContent config={this.props.config} />,+// onCancel: () => {+// this.showModal(0, false);+// },+// },+// {+// show: false,+// group: [+// {+// locale: 'button.close',+// },+// ],+// },+// {+// show: false,+// group: [+// {+// locale: 'button.close',+// },+// ],+// },+// ],+// };+// }++// /**+// * init+// */+// componentWillMount() {+// this.setLocale();++// // subscribe Locale change event++// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }++// /**+// * destory+// */+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }++// /**+// * set text by config setting and Locale message+// */+// setLocale() {+// const locale = this._context.getLocale();+// this.setState((prevState: IState) => {+// let item = prevState.splitColumn;+// // set current Locale string for tooltip+// item.tooltip = locale.get(`${item.locale}`);++// let notice = prevState.notice;+// notice.forEach((ele) => {+// ele.label = locale.get(ele.locale);+// });++// let modalData = prevState.modalData;+// modalData.forEach((ele, index) => {+// ele.title = locale.get(ele.locale!);+// if (ele.group && ele.group.length) {+// ele.group.forEach((node) => {+// node.label = locale.get(node.locale!);+// });+// }+// if (index === 1) {+// ele.children = <p>{notice[0].label}</p>;+// }+// if (index === 2) {+// ele.children = <p>{notice[1].label}</p>;+// }+// });++// return {+// splitColumn: item,+// modalData,+// notice,+// };+// });+// }++// showModal = (index: number, isShow: boolean) => {+// let { modalData } = this.state;+// modalData[index].show = isShow;+// this.setState((prevState) => ({+// modalData,+// }));+// };++// /**+// * Render the component's HTML+// *+// * @returns {void}+// */+// render(props: IProps, state: IState) {+// const Button = this.Render.renderFunction('Button');+// const Modal = this.Render.renderFunction('Modal');+// const { splitColumn, modalData } = state;+// // Set Provider for entire Container+// return (+// <div className={styles.singleButton}>+// <Button type="text" onClick={() => this.showModal(0, true)}>+// {splitColumn.label}+// </Button>+// {modalData.map((item) => {+// if (!item.show) return;+// return <Modal visible={item.show} onCancel={item.onCancel} title={item.title} group={item.group} children={item.children}></Modal>;+// })}+// </div>+// );+// }+// }diff --git a/packages/sheets-plugin-split-column/src/UI/SplitColumnContent.tsx b/packages/sheets-plugin-split-column/src/UI/SplitColumnContent.tsxindex e9e5e3f09b..8714222319 100644--- a/packages/sheets-plugin-split-column/src/UI/SplitColumnContent.tsx+++ b/packages/sheets-plugin-split-column/src/UI/SplitColumnContent.tsx@@ -1,117 +1,117 @@-import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { SheetPlugin } from '@univerjs/base-sheets';-import styles from './index.module.less';+// import { BaseComponentRender, BaseComponentSheet, Component } from '@univerjs/base-ui';+// import { Nullable, Observer, Workbook } from '@univerjs/core';+// import { SheetPlugin } from '@univerjs/base-sheets';+// import styles from './index.module.less';-type SplitContextProps = {- config?: any;-};-type SplitContextState = {- SplitGroup: SplitGroup[];- symbol: SplitGroup;- divide: SplitGroup;- preview: SplitGroup;-};-type SplitGroup = {- name: string;- label?: string;- value?: string;- content?: string;-};+// type SplitContextProps = {+// config?: any;+// };+// type SplitContextState = {+// SplitGroup: SplitGroup[];+// symbol: SplitGroup;+// divide: SplitGroup;+// preview: SplitGroup;+// };+// type SplitGroup = {+// name: string;+// label?: string;+// value?: string;+// content?: string;+// };-export class SplitColumnContent extends Component<SplitContextProps, SplitContextState> {- private _localeObserver: Nullable<Observer<Workbook>>;+// export class SplitColumnContent extends Component<SplitContextProps, SplitContextState> {+// private _localeObserver: Nullable<Observer<Workbook>>;- Render: BaseComponentRender;+// Render: BaseComponentRender;- initialize() {- const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;- this.Render = component.getComponentRender();- this.state = {- SplitGroup: [- {- name: 'punctuation.tab',- },- {- name: 'punctuation.semicolon',- },- {- name: 'punctuation.comma',- },- {- name: 'punctuation.space',- },- {- name: 'splitColumn.splitOther',- },- ],- symbol: {- name: 'splitColumn.splitDelimiters',- },- divide: {- name: 'splitColumn.splitContinueSymbol',- },- preview: {- name: 'splitColumn.splitDataPreview',- content: '',- },- };- }+// initialize() {+// const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+// this.Render = component.getComponentRender();+// this.state = {+// SplitGroup: [+// {+// name: 'punctuation.tab',+// },+// {+// name: 'punctuation.semicolon',+// },+// {+// name: 'punctuation.comma',+// },+// {+// name: 'punctuation.space',+// },+// {+// name: 'splitColumn.splitOther',+// },+// ],+// symbol: {+// name: 'splitColumn.splitDelimiters',+// },+// divide: {+// name: 'splitColumn.splitContinueSymbol',+// },+// preview: {+// name: 'splitColumn.splitDataPreview',+// content: '',+// },+// };+// }- setLocale() {- const locale = this._context.getLocale();- this.setState((prevState) => {- let { SplitGroup, symbol, divide, preview } = prevState;- SplitGroup.forEach((item) => {- item.label = locale.get(item.name);- });- symbol.label = locale.get(symbol.name);- divide.label = locale.get(divide.name);- preview.label = locale.get(preview.name);+// setLocale() {+// const locale = this._context.getLocale();+// this.setState((prevState) => {+// let { SplitGroup, symbol, divide, preview } = prevState;+// SplitGroup.forEach((item) => {+// item.label = locale.get(item.name);+// });+// symbol.label = locale.get(symbol.name);+// divide.label = locale.get(divide.name);+// preview.label = locale.get(preview.name);- return {- SplitGroup,- symbol,- divide,- preview,- };- });- }+// return {+// SplitGroup,+// symbol,+// divide,+// preview,+// };+// });+// }- componentWillMount() {- this.setLocale();+// componentWillMount() {+// this.setLocale();- // subscribe Locale change event- this._localeObserver = this._context- .getObserverManager()- .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')- ?.add(() => {- this.setLocale();- });- }+// // subscribe Locale change event+// this._localeObserver = this._context+// .getObserverManager()+// .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+// ?.add(() => {+// this.setLocale();+// });+// }- componentWillUnmount() {- // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);- }+// componentWillUnmount() {+// // this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+// }- render(props: SplitContextProps, state: SplitContextState) {- const CheckboxGroup = this.Render.renderFunction('CheckboxGroup');- const Checkbox = this.Render.renderFunction('Checkbox');- const Input = this.Render.renderFunction('Input');- const { SplitGroup, symbol, divide, preview } = state;- return (- <div className={styles.splitContent}>- <p>{symbol.label}</p>- <div className={styles.splitBox}>- <CheckboxGroup options={SplitGroup}></CheckboxGroup>- <Input />- </div>- <div className={styles.splitDivid}>- <Checkbox value={divide.value}>{divide.label}</Checkbox>- </div>- <p>{preview.label}</p>- <div className={styles.splitPreview}>{preview.content}</div>- </div>- );- }-}+// render(props: SplitContextProps, state: SplitContextState) {+// const CheckboxGroup = this.Render.renderFunction('CheckboxGroup');+// const Checkbox = this.Render.renderFunction('Checkbox');+// const Input = this.Render.renderFunction('Input');+// const { SplitGroup, symbol, divide, preview } = state;+// return (+// <div className={styles.splitContent}>+// <p>{symbol.label}</p>+// <div className={styles.splitBox}>+// <CheckboxGroup options={SplitGroup}></CheckboxGroup>+// <Input />+// </div>+// <div className={styles.splitDivid}>+// <Checkbox value={divide.value}>{divide.label}</Checkbox>+// </div>+// <p>{preview.label}</p>+// <div className={styles.splitPreview}>{preview.content}</div>+// </div>+// );+// }+// }diff --git a/packages/ui-plugin-sheets/src/Controller/RightMenuUIController.ts b/packages/ui-plugin-sheets/src/Controller/RightMenuUIController.tsindex 866647a65b..ff35196e77 100644--- a/packages/ui-plugin-sheets/src/Controller/RightMenuUIController.ts+++ b/packages/ui-plugin-sheets/src/Controller/RightMenuUIController.ts@@ -7,7 +7,6 @@ import { DefaultRightMenuConfig, SheetRightMenuConfig } from '../Basics';import { RightMenu, RightMenuInput, RightMenuItem } from '../View';import styles from '../View/RightMenu/index.module.less';-interface CustomLabelProps {prefix?: string[] | string;suffix?: string[] | string;@@ -17,7 +16,7 @@ interface CustomLabelProps {onKeyUp?: (e: Event) => void;}-export interface CustomLabel{+export interface CustomLabel {name: string;props?: CustomLabelProps;}diff --git a/packages/ui-plugin-sheets/src/Controller/ToolbarUIController.ts b/packages/ui-plugin-sheets/src/Controller/ToolbarUIController.tsindex f6f42f773c..f5958bca74 100644--- a/packages/ui-plugin-sheets/src/Controller/ToolbarUIController.ts+++ b/packages/ui-plugin-sheets/src/Controller/ToolbarUIController.ts@@ -231,7 +231,7 @@ export class ToolbarUIController {this.hideTooltip();const textColor = this._toolList.find((item) => item.name === 'textColor');if (!textColor || !textColor.label) return;- if (!((textColor.label as CustomComponent).props?.color)) return;+ if (!(textColor.label as CustomComponent).props?.color) return;(textColor.label as CustomComponent).props!.color = this._textColor;this.changeColor(this._textColor);},@@ -276,7 +276,7 @@ export class ToolbarUIController {this.hideTooltip();const fillColor = this._toolList.find((item) => item.name === 'fillColor');if (!fillColor || !fillColor.label) return;- if (!((fillColor.label as CustomComponent).props?.color)) return;+ if (!(fillColor.label as CustomComponent).props?.color) return;(fillColor.label as CustomComponent).props!.color = this._background;this.setBackground(this._background);},@@ -341,7 +341,7 @@ export class ToolbarUIController {const borderItem = this._toolList.find((item) => item.name === 'border');const lineColor = borderItem?.children?.find((item) => item.name === 'borderColor');if (!lineColor || !lineColor.label) return;- if (!((lineColor.label as CustomComponent).props?.color)) return;+ if (!(lineColor.label as CustomComponent).props?.color) return;(lineColor.label as CustomComponent).props!.color = color;},},@@ -364,10 +364,10 @@ export class ToolbarUIController {},onClick: (...arg) => {arg[0].stopPropagation();- const label = BORDER_SIZE_CHILDREN[arg[2]].label- if(typeof label === 'string'){+ const label = BORDER_SIZE_CHILDREN[arg[2]].label;+ if (typeof label === 'string') {this._lineBold.setImg(label);- }else{+ } else {this._lineBold.setImg(label.name);}this._borderInfo.style = arg[1];diff --git a/packages/ui-plugin-sheets/src/View/Common/ColorSelect/ColorSelect.tsx b/packages/ui-plugin-sheets/src/View/Common/ColorSelect/ColorSelect.tsxindex c401164161..99f3786852 100644--- a/packages/ui-plugin-sheets/src/View/Common/ColorSelect/ColorSelect.tsx+++ b/packages/ui-plugin-sheets/src/View/Common/ColorSelect/ColorSelect.tsx@@ -13,7 +13,6 @@ interface IState {}export class ColorSelect extends Component<IProps, IState> {-componentDidMount(): void {this.props.getComponent?.(this);}@@ -31,7 +30,7 @@ export class ColorSelect extends Component<IProps, IState> {}render() {- const {label} = this.props+ const { label } = this.props;return (<div className={styles.colorSelect}><div>{this.getLabel(label)}</div>diff --git a/packages/ui-plugin-sheets/src/View/Common/Line/LineBold.tsx b/packages/ui-plugin-sheets/src/View/Common/Line/LineBold.tsxindex 9547fddf68..c861364dfb 100644--- a/packages/ui-plugin-sheets/src/View/Common/Line/LineBold.tsx+++ b/packages/ui-plugin-sheets/src/View/Common/Line/LineBold.tsx@@ -1,6 +1,4 @@import { BaseComponentProps, Component, Icon } from '@univerjs/base-ui';-import { SheetUIPlugin } from '../../..';-import { SHEET_UI_PLUGIN_NAME } from '../../../Basics';interface IState {img: string;@@ -39,7 +37,7 @@ export class LineBold extends Component<IProps, IState> {const span = document.querySelector('.base-sheets-line-bold') as HTMLDivElement;const props = { width: span.offsetWidth };const Img = this.context.componentManager.get(img);- if(Img){+ if (Img) {return <Img {...(props as any)} />;}}diff --git a/packages/ui-plugin-sheets/src/View/RightMenu/RightMenu.tsx b/packages/ui-plugin-sheets/src/View/RightMenu/RightMenu.tsxindex 42e4a0625e..05d85ba254 100644--- a/packages/ui-plugin-sheets/src/View/RightMenu/RightMenu.tsx+++ b/packages/ui-plugin-sheets/src/View/RightMenu/RightMenu.tsx@@ -1,6 +1,6 @@import { IMouseEvent } from '@univerjs/base-render';-import { BaseRightMenuProps, Component, createRef, Menu } from '@univerjs/base-ui';-import { RightMenuProps } from '../../Controller';+import { BaseRightMenuProps, Component, createRef, Menu } from '@univerjs/base-ui';+import { RightMenuProps } from '../../Controller';import Style from './index.module.less';interface IState {diff --git a/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx b/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsxindex 7e673e4875..c1912832eb 100644--- a/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx+++ b/packages/ui-plugin-sheets/src/View/SheetBar/SheetBar.tsx@@ -1,9 +1,7 @@import { BaseMenuItem, BaseSheetBarProps, Button, Component, createRef, Icon, Menu, RefObject } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';import { SheetBarMenu } from './SheetBarMenu';import styles from './index.module.less';import { SlideTabBar } from '../../Basics/SlideTabBar/SlideTabBar';-import { SheetUIPlugin, SHEET_UI_PLUGIN_NAME } from '../..';type SheetState = {sheetList: BaseSheetBarProps[];diff --git a/packages/ui-plugin-sheets/src/View/Toolbar/Toolbar.tsx b/packages/ui-plugin-sheets/src/View/Toolbar/Toolbar.tsxindex 256535aa9d..97337016eb 100644--- a/packages/ui-plugin-sheets/src/View/Toolbar/Toolbar.tsx+++ b/packages/ui-plugin-sheets/src/View/Toolbar/Toolbar.tsx@@ -1,4 +1,4 @@-import { AppContext, AppContextValues, BaseComponentProps, Button, Component, Container, createRef, debounce, PreactContext, Select, Tooltip } from '@univerjs/base-ui';+import { AppContext, AppContextValues, BaseComponentProps, Button, Component, Container, createRef, debounce, PreactContext, Select, Tooltip } from '@univerjs/base-ui';import { SheetUIPlugin } from '../..';import { SHEET_UI_PLUGIN_NAME } from '../../Basics';import { IToolbarItemProps } from '../../Controller';