Skip to content

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.

refactor(base-ui): change class to function component (#129)

Dushusir812f782eff4f
diff --git a/.eslintrc.js b/.eslintrc.js
index 4c3d68d5b5..72bc8eacff 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -95,7 +95,6 @@ module.exports = {
// eslint-plugin-unused-imports
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
- 'max-lines-per-function': ['error', 80],
'prefer-regex-literals': 'off',
'@typescript-eslint/default-param-last': 'off',
'grouped-accessor-pairs': 'off',
diff --git a/packages/base-numfmt-engine/test/numfmt.test.ts b/packages/base-numfmt-engine/test/numfmt.test.ts
deleted file mode 100644
index 30bdcb13d4..0000000000
--- a/packages/base-numfmt-engine/test/numfmt.test.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { numfmt } from '../src/index';
-
-test('numfmt custom', () => {
- const formatter = numfmt('[green]#,##0;[red]-#,##0');
- expect(formatter(100)).toEqual('100');
-});
-
-test('numfmt color', () => {
- const formatter = numfmt('[green]#,##0;[red]-#,##0');
- expect(formatter.color(-10)).toEqual('red');
- expect(formatter.color(10)).toEqual('green');
-});
-
-test('numfmt number', () => {
- const formatter = numfmt('[green]#,##0;[red]-#,##0');
- const color = formatter.color(-10);
- expect(color).toEqual('red');
-});
-
-test('numfmt date', () => {
- const formatter = numfmt('yyyy"年"m"月"d"日";@');
- expect(formatter(0)).toEqual('1900年1月0日');
-});
-
-test('numfmt time', () => {
- const formatter = numfmt('[$-409]h:mm:ss AM/PM;@');
- expect(formatter(12)).toEqual('12:00:00 AM');
-});
-
-test('numfmt currency', () => {
- const formatter = numfmt('¥#,##0.00;[red]¥#,##0.00');
- expect(formatter(1.0)).toEqual('¥1.00');
-});
-
-test('numfmt percentage', () => {
- const formatter = numfmt('0.00%');
- expect(formatter(0.1)).toEqual('10.00%');
-});
-
-test('numfmt percentage', () => {
- const formatter = numfmt();
- console.log(formatter(0));
-});
diff --git a/packages/base-ui/src/BaseComponent.ts b/packages/base-ui/src/BaseComponent.ts
index a333049d8d..e41ea4e0ca 100644
--- a/packages/base-ui/src/BaseComponent.ts
+++ b/packages/base-ui/src/BaseComponent.ts
@@ -1,16 +1,8 @@
-import { ComponentClass } from 'react';
-import { ForwardFn } from 'react';
-import { BasePlugin } from '@univerjs/core';
import { Context } from '@univerjs/core/src/Basics/Context';
-import { Description } from './Interfaces';
+import { ComponentClass, ForwardFn } from 'react';
// TODO Button const enum; BaseComponentSheet => BaseComponentXXX
-// UniverSheet base component
-export interface BaseComponentSheet extends BasePlugin {
- getComponentRender(): BaseComponentRender;
- getComponentFactory(): BaseComponentFactory;
-}
export interface BaseComponentProps {
getComponent?: (ref: any) => void; //获取自身组件
id?: string; // 组件id
@@ -22,49 +14,7 @@ export interface BaseComponentProps {
export interface BaseComponent<T = any> {
render(): JSXComponent<T>;
}
-export interface BaseComponentFactory {
- createComponent<T extends BaseComponent>(name: string): T;
-}
-export interface BaseComponentRender {
- renderForwardFn<T extends keyof Description>(name: string): ForwardFnComponent<PropsFrom<Description[T]>>;
- renderClass<T extends keyof Description>(name: string): ClassComponent<PropsFrom<Description[T]>>;
- renderFunction<T extends keyof Description>(name: T): FunctionComponent<PropsFrom<Description[T]>>;
-}
-
-// Components interface
-const ButtonTypes: string[] = ['default', 'primary'];
-export type ButtonType = typeof ButtonTypes[number];
-const ButtonShapes: string[] = ['circle', 'round'];
-export type ButtonShape = typeof ButtonShapes[number];
-const SizeTypes: string[] = ['small', 'middle', 'large'];
-export type SizeType = typeof SizeTypes[number];
-const ButtonHTMLTypes: string[] = ['submit', 'rest', 'button'];
-export type ButtonHTMLType = typeof ButtonHTMLTypes[number];
-
-export interface BaseButtonProps extends BaseComponentProps {
- type?: ButtonType;
- shape?: ButtonShape;
- size?: SizeType;
- danger?: boolean;
- disabled?: boolean;
- block?: boolean;
- loading?: boolean;
- active?: boolean;
- htmlType?: ButtonHTMLType;
- onClick?: Function;
- children?: any;
- className?: string;
- style?: JSX.CSSProperties;
- unActive?: boolean;
-}
-
-// component class
-export interface ButtonComponent extends BaseComponent<BaseButtonProps> {
- render(): JSXComponent<BaseButtonProps>;
-}
-
// component type
-export type PropsFrom<T> = T extends BaseComponent<infer Props> ? Props : void;
export type FunctionComponent<T = void> = (props: T) => JSX.Element;
export type ClassComponent<T = any, E = any> = ComponentClass<T, E>;
export type ForwardFnComponent<T> = ForwardFn<T>;
diff --git a/packages/base-ui/src/Common/ZIndexManager.ts b/packages/base-ui/src/Common/ZIndexManager.ts
index da8f6dee68..c4a8fe41d5 100644
--- a/packages/base-ui/src/Common/ZIndexManager.ts
+++ b/packages/base-ui/src/Common/ZIndexManager.ts
@@ -1,8 +1,8 @@
export class ZIndexManager {
- private _list: Map<string, string> = new Map();
+ private _list: Map<string, number> = new Map();
- setIndex(name: string, value: string) {
- this._list.set(name, value);
+ setIndex(name: string, index: number) {
+ this._list.set(name, index);
}
getIndex(name: string) {
diff --git a/packages/base-ui/src/Components/Avatar/Avatar.tsx b/packages/base-ui/src/Components/Avatar/Avatar.tsx
index fb1ccb1a70..7ee9021ebc 100644
--- a/packages/base-ui/src/Components/Avatar/Avatar.tsx
+++ b/packages/base-ui/src/Components/Avatar/Avatar.tsx
@@ -1,29 +1,30 @@
-import { JSXComponent } from '../../BaseComponent';
-import { BaseAvatarProps, AvatarComponent } from '../../Interfaces';
+import React from 'react';
+
+import { BaseComponentProps } from '../../BaseComponent';
import { joinClassNames } from '../../Utils';
import styles from './Style/index.module.less';
-// type Shape = 'circle' | 'square';
+type Shape = 'circle' | 'square';
// type BreakPoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
// type AvatatScreen = Partial<Record<BreakPoint, number>>;
// type AvatarSize = number | 'large' | 'small' | 'default' | AvatatScreen;
-// type AvatarSize = number | 'large' | 'small' | 'default';
-// type ImageFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
+type AvatarSize = number | 'large' | 'small' | 'default';
+type ImageFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
-// export interface AvatarProps {
-// alt?: string;
-// shape?: Shape;
-// size?: AvatarSize;
-// src?: string;
-// style?: JSX.CSSProperties;
-// fit?: ImageFit;
-// children?: any;
-// onError?: () => void;
-// onLoad?: () => void;
-// title?: string;
-// }
+export interface BaseAvatarProps extends BaseComponentProps {
+ alt?: string;
+ shape?: Shape;
+ size?: AvatarSize;
+ src?: string;
+ style?: React.CSSProperties;
+ fit?: ImageFit;
+ children?: any;
+ onError?: () => void;
+ onLoad?: () => void;
+ title?: string;
+}
-export const Avatar = (props: BaseAvatarProps) => {
+export function Avatar(props: BaseAvatarProps) {
const { alt, shape = 'circle', size, src, onError, style, fit = 'fill', children, onLoad, title } = props;
// const responseSize = () => {
@@ -64,10 +65,4 @@ export const Avatar = (props: BaseAvatarProps) => {
{children}
</span>
);
-};
-
-export class UniverAvatar implements AvatarComponent {
- render(): JSXComponent<BaseAvatarProps> {
- return Avatar;
- }
}
diff --git a/packages/base-ui/src/Components/Button/Button.tsx b/packages/base-ui/src/Components/Button/Button.tsx
index 4cc6bcb640..2ac2281581 100644
--- a/packages/base-ui/src/Components/Button/Button.tsx
+++ b/packages/base-ui/src/Components/Button/Button.tsx
@@ -1,49 +1,139 @@
-import { Component } from 'react';
-import { BaseButtonProps } from '../../BaseComponent';
-import { joinClassNames } from '../../Utils';
-import { LoadingIcon } from '../Icon';
+import { useEffect, useState } from 'react';
+import { BaseComponent, BaseComponentProps, JSXComponent } from '../../BaseComponent';
+import { joinClassNames } from '../../Utils/util';
+import { LoadingIcon } from '../Icon';
import styles from './Style/index.module.less';
-// const ButtonTypes: string[] = ['default', 'primary'];
-// export type ButtonType = typeof ButtonTypes[number];
-// const ButtonShapes: string[] = ['circle', 'round'];
-// export type ButtonShape = typeof ButtonShapes[number];
-// const SizeTypes: string[] = ['small', 'middle', 'large'];
-// export type SizeType = typeof SizeTypes[number];
-// const ButtonHTMLTypes: string[] = ['submit', 'rest', 'button'];
-// export type ButtonHTMLType = typeof ButtonHTMLTypes[number];
-
-// export interface BaseButtonProps extends BaseComponentProps {
-// type?: ButtonType;
-// shape?: ButtonShape;
-// size?: SizeType;
-// danger?: boolean;
-// disabled?: boolean;
-// block?: boolean;
-// loading?: boolean;
-// htmlType?: ButtonHTMLType;
-// onClick?: Function;
-// children?: any;
-// className?: string;
-// style?: JSX.CSSProperties;
-// isActive?: true;
-// }
+// Components interface
+const ButtonTypes: string[] = ['default', 'primary'];
+export type ButtonType = 'default' | 'primary';
+const ButtonShapes: string[] = ['circle', 'round'];
+export type ButtonShape = 'circle' | 'round';
+const SizeTypes: string[] = ['small', 'middle', 'large'];
+export type SizeType = 'small' | 'middle' | 'large';
+const ButtonHTMLTypes: string[] = ['submit', 'reset', 'button'];
+export type ButtonHTMLType = 'submit' | 'reset' | 'button';
-interface IState {
- isActive: boolean;
+export interface BaseButtonProps extends BaseComponentProps {
+ type?: ButtonType;
+ shape?: ButtonShape;
+ size?: SizeType;
+ danger?: boolean;
+ disabled?: boolean;
+ block?: boolean;
+ loading?: boolean;
+ active?: boolean;
+ htmlType?: ButtonHTMLType;
+ onClick?: Function;
+ children?: any;
+ className?: string;
+ style?: React.CSSProperties;
+ unActive?: boolean;
}
-class Button extends Component<BaseButtonProps, IState> {
- constructor(props: BaseButtonProps) {
- super();
- this.state = {
- isActive: props.active ?? false,
- };
- }
+// component class
+export interface ButtonComponent extends BaseComponent<BaseButtonProps> {
+ render(): JSXComponent<BaseButtonProps>;
+}
+
+// interface IState {
+// isActive: boolean;
+// }
+
+// class Button extends Component<BaseButtonProps, IState> {
+// constructor(props: BaseButtonProps) {
+// super();
+// this.state = {
+// isActive: props.active ?? false,
+// };
+// }
+
+// getSizeCls() {
+// const { size } = this.props;
+// let sizeCls = '';
+// switch (size) {
+// case 'large':
+// sizeCls = 'lg';
+// break;
+// case 'small':
+// sizeCls = 'sm';
+// break;
+// default:
+// break;
+// }
+// return sizeCls;
+// }
+
+// getClass() {
+// const { isActive } = this.state;
+// const { type, shape, danger, block, loading, size, className } = this.props;
+// return joinClassNames(
+// styles.btn,
+// {
+// [`${styles.btn}-${type}`]: type,
+// [`${styles.btn}-${shape}`]: shape,
+// [`${styles.btn}-${this.getSizeCls()}`]: size,
+// [`${styles.btn}-danger`]: !!danger,
+// [`${styles.btn}-block`]: block,
+// [`${styles.btn}-loading`]: loading,
+// [`${styles.btn}-active`]: isActive,
+// },
+// className
+// );
+// }
+
+// handleClick = (e: MouseEvent) => {
+// const { disabled, onClick, unActive = true } = this.props;
+
+// if (disabled) {
+// e.preventDefault();
+// return;
+// }
+
+// if (unActive) {
+// onClick?.(e);
+// return;
+// }
+
+// this.setState(
+// {
+// isActive: !this.state.isActive,
+// },
+// () => {
+// if (onClick) {
+// onClick.call(null, e, this.state.isActive);
+// }
+// }
+// );
+// };
+
+// override UNSAFE_componentWillReceiveProps(props: BaseButtonProps) {
+// this.setState({
+// isActive: props.active,
+// });
+// }
- getSizeCls() {
- const { size } = this.props;
+// render() {
+// const { htmlType, disabled, style, loading, children } = this.props;
+// return (
+// <button type={htmlType} onClick={this.handleClick} className={this.getClass()} disabled={disabled} style={style}>
+// {loading ? <LoadingIcon /> : ''}
+// {children}
+// </button>
+// );
+// }
+// }
+
+export function Button(props: BaseButtonProps) {
+ const [isActive, setIsActive] = useState(props.active ?? false);
+
+ useEffect(() => {
+ setIsActive(props.active ?? false);
+ }, [props.active]);
+
+ const getSizeCls = () => {
+ const { size } = props;
let sizeCls = '';
switch (size) {
case 'large':
@@ -56,17 +146,16 @@ class Button extends Component<BaseButtonProps, IState> {
break;
}
return sizeCls;
- }
+ };
- getClass() {
- const { isActive } = this.state;
- const { type, shape, danger, block, loading, size, className } = this.props;
+ const getClass = () => {
+ const { type, shape, danger, block, loading, size, className } = props;
return joinClassNames(
styles.btn,
{
[`${styles.btn}-${type}`]: type,
[`${styles.btn}-${shape}`]: shape,
- [`${styles.btn}-${this.getSizeCls()}`]: size,
+ [`${styles.btn}-${getSizeCls()}`]: size,
[`${styles.btn}-danger`]: !!danger,
[`${styles.btn}-block`]: block,
[`${styles.btn}-loading`]: loading,
@@ -74,10 +163,10 @@ class Button extends Component<BaseButtonProps, IState> {
},
className
);
- }
+ };
- handleClick = (e: MouseEvent) => {
- const { disabled, onClick, unActive = true } = this.props;
+ const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
+ const { disabled, onClick, unActive = true } = props;
if (disabled) {
e.preventDefault();
@@ -89,33 +178,18 @@ class Button extends Component<BaseButtonProps, IState> {
return;
}
- this.setState(
- {
- isActive: !this.state.isActive,
- },
- () => {
- if (onClick) {
- onClick.call(null, e, this.state.isActive);
- }
- }
- );
+ setIsActive(!isActive);
+
+ if (onClick) {
+ onClick.call(e, isActive);
+ }
};
- override UNSAFE_componentWillReceiveProps(props: BaseButtonProps) {
- this.setState({
- isActive: props.active,
- });
- }
-
- render() {
- const { htmlType, disabled, style, loading, children } = this.props;
- return (
- <button type={htmlType} onClick={this.handleClick} className={this.getClass()} disabled={disabled} style={style}>
- {loading ? <LoadingIcon /> : ''}
- {children}
- </button>
- );
- }
+ const { htmlType, disabled, style, loading, children } = props;
+ return (
+ <button type={htmlType} onClick={handleClick} className={getClass()} disabled={disabled} style={style}>
+ {loading ? <LoadingIcon /> : ''}
+ {children}
+ </button>
+ );
}
-
-export default Button;
diff --git a/packages/base-ui/src/Components/Button/button.md b/packages/base-ui/src/Components/Button/button.md
index 324a550da0..4c9c22cd72 100644
--- a/packages/base-ui/src/Components/Button/button.md
+++ b/packages/base-ui/src/Components/Button/button.md
@@ -36,7 +36,7 @@ Different button styles can be generated by setting Button properties. The recom
| type | Can be set to `primary` `ghost` `dashed` `link` `text` `default` | string | `default` |
| onClick | Set the handler to handle `click` event | (event) => void | - |
| children: | Button content or child nodes | any | - |
-| className: | classname | string | - |
+| className: | className | string | - |
It accepts all props which native buttons support.
diff --git a/packages/base-ui/src/Components/Button/index.ts b/packages/base-ui/src/Components/Button/index.ts
index d0db3c1a54..fe9c53c511 100644
--- a/packages/base-ui/src/Components/Button/index.ts
+++ b/packages/base-ui/src/Components/Button/index.ts
@@ -1,3 +1 @@
-import Button from './Button';
-
-export { Button };
+export { Button } from './Button';
diff --git a/packages/base-ui/src/Components/Button/test/index.test.tsx b/packages/base-ui/src/Components/Button/test/index.test.tsx
index dc66a3c8c3..1075517ef6 100644
--- a/packages/base-ui/src/Components/Button/test/index.test.tsx
+++ b/packages/base-ui/src/Components/Button/test/index.test.tsx
@@ -5,7 +5,7 @@ import { Button } from '..';
describe('Button', () => {
test('should display initial Button', () => {
const { container } = render(
- <Button type="text" onClick={() => {}}>
+ <Button type="primary" onClick={() => {}}>
哈哈
</Button>
);
@@ -16,7 +16,7 @@ describe('Button', () => {
render(
<Button
- type="text"
+ type="default"
onClick={() => {
a++;
}}
diff --git a/packages/base-ui/src/Components/CellRange/CellRange.tsx b/packages/base-ui/src/Components/CellRange/CellRange.tsx
index 7f4ac53275..ea7358d878 100644
--- a/packages/base-ui/src/Components/CellRange/CellRange.tsx
+++ b/packages/base-ui/src/Components/CellRange/CellRange.tsx
@@ -1,8 +1,100 @@
-import { Component, createRef } from 'react';
-import { Icon, Modal } from '..';
+// import { Component, createRef } from 'react';
+
+// import { BaseComponentProps } from '../../BaseComponent';
+// import { ModalButtonGroup } from '../../Interfaces';
+// import { Icon, Modal } from '..';
+// import { Input } from '../Input';
+// import styles from './index.module.less';
+
+// export interface BaseCellRangeModalProps extends BaseComponentProps {
+// value?: string;
+// placeholder?: string;
+// title?: string;
+// contentPlaceholder?: string;
+// onClick?: (e: Event) => void;
+// onChange?: (e: Event) => void;
+// }
+
+// type IState = {
+// value: string;
+// show: boolean;
+// };
+
+// export class CellRange extends Component<BaseCellRangeModalProps, IState> {
+// ref = createRef();
+
+// group: ModalButtonGroup[];
+
+// constructor(props: BaseCellRangeModalProps) {
+// super();
+
+// this.state = {
+// value: props.value ?? '',
+// show: false,
+// };
+
+// this.group = [
+// {
+// label: 'button.confirm',
+// type: 'primary',
+// onClick: props.onClick,
+// },
+// ];
+// }
+
+// showModal(show: boolean) {
+// this.setState({
+// show,
+// });
+// }
+
+// /**
+// * modify input value when success
+// */
+// handleOk = (e: Event) => {
+// const { onClick } = this.props;
+// const value = this.ref.current.getValue();
+// onClick?.(e);
+// this.showModal(false);
+// };
+
+// handleChange = (e: Event) => {
+// const { onChange } = this.props;
+// onChange?.(e);
+// };
+
+// override UNSAFE_componentWillReceiveProps(props: BaseCellRangeModalProps) {
+// if (props.value !== this.state.value) {
+// this.setState({
+// value: props.value,
+// });
+// }
+// }
+
+// render() {
+// const { placeholder, title, contentPlaceholder } = this.props;
+// const { value, show } = this.state;
+
+// return (
+// <div className={styles.cellRangeModal}>
+// <Input placeholder={placeholder} value={value} onChange={this.handleChange}></Input>
+// <span className={styles.cellModalIcon} onClick={() => this.showModal(true)}>
+// <Icon.Sheet.TableIcon />
+// </span>
+// <Modal title={title} visible={show} group={this.group}>
+// <Input readOnly={true} placeholder={contentPlaceholder} value={value} ref={this.ref}></Input>
+// </Modal>
+// </div>
+// );
+// }
+// }
+
+import React, { useState } from 'react';
+
import { BaseComponentProps } from '../../BaseComponent';
-import { ModalButtonGroup } from '../../Interfaces';
+import { Icon, Modal } from '..';
import { Input } from '../Input';
+import { ModalButtonGroup } from '../Modal/Modal';
import styles from './index.module.less';
export interface BaseCellRangeModalProps extends BaseComponentProps {
@@ -10,80 +102,43 @@ export interface BaseCellRangeModalProps extends BaseComponentProps {
placeholder?: string;
title?: string;
contentPlaceholder?: string;
- onClick?: (e: Event) => void;
+ onClick: () => void;
onChange?: (e: Event) => void;
}
-type IState = {
- value: string;
- show: boolean;
-};
-
-export class CellRange extends Component<BaseCellRangeModalProps, IState> {
- ref = createRef();
-
- group: ModalButtonGroup[];
-
- constructor(props: BaseCellRangeModalProps) {
- super();
-
- this.state = {
- value: props.value ?? '',
- show: false,
- };
-
- this.group = [
- {
- label: 'button.confirm',
- type: 'primary',
- onClick: props.onClick,
- },
- ];
- }
-
- showModal(show: boolean) {
- this.setState({
- show,
- });
- }
-
- /**
- * modify input value when success
- */
- handleOk = (e: Event) => {
- const { onClick } = this.props;
- const value = this.ref.current.getValue();
- onClick?.(e);
- this.showModal(false);
- };
+export function CellRange(props: BaseCellRangeModalProps) {
+ const [value, setValue] = useState(props.value ?? '');
+ const [show, setShow] = useState(false);
+
+ const group: ModalButtonGroup[] = [
+ {
+ label: 'button.confirm',
+ type: 'primary',
+ onClick: props.onClick,
+ },
+ ];
+
+ // const handleOk = (e: Event) => {
+ // const { onClick } = props;
+ // onClick?.(e);
+ // setShow(false);
+ // };
- handleChange = (e: Event) => {
- const { onChange } = this.props;
- onChange?.(e);
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
+ const { onChange } = props;
+ setValue(e.target.value);
+ onChange?.(e.nativeEvent);
};
- override UNSAFE_componentWillReceiveProps(props: BaseCellRangeModalProps) {
- if (props.value !== this.state.value) {
- this.setState({
- value: props.value,
- });
- }
- }
-
- render() {
- const { placeholder, title, contentPlaceholder } = this.props;
- const { value, show } = this.state;
-
- return (
- <div className={styles.cellRangeModal}>
- <Input placeholder={placeholder} value={value} onChange={this.handleChange}></Input>
- <span className={styles.cellModalIcon} onClick={() => this.showModal(true)}>
- <Icon.Sheet.TableIcon />
- </span>
- <Modal title={title} visible={show} group={this.group}>
- <Input readOnly={true} placeholder={contentPlaceholder} value={value} ref={this.ref}></Input>
- </Modal>
- </div>
- );
- }
+ return (
+ <div className={styles.cellRangeModal}>
+ <Input placeholder={props.placeholder} value={value} onChange={handleChange}></Input>
+ <span className={styles.cellModalIcon} onClick={() => setShow(true)}>
+ <Icon.Sheet.TableIcon />
+ </span>
+ <Modal title={props.title} visible={show} group={group}>
+ <Input readonly={true} placeholder={props.contentPlaceholder} value={value}></Input>
+ </Modal>
+ </div>
+ );
}
diff --git a/packages/base-ui/src/Components/Checkbox/Checkbox.tsx b/packages/base-ui/src/Components/Checkbox/Checkbox.tsx
index 75d659415b..c8b527af78 100644
--- a/packages/base-ui/src/Components/Checkbox/Checkbox.tsx
+++ b/packages/base-ui/src/Components/Checkbox/Checkbox.tsx
@@ -1,6 +1,6 @@
-import { Component } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseCheckboxProps, CheckboxComponent } from '../../Interfaces';
+import { useEffect, useState } from 'react';
+
+import { BaseComponentProps } from '../../BaseComponent';
import { joinClassNames } from '../../Utils';
import styles from './index.module.less';
// export type CheckboxBaseProps = {
@@ -13,60 +13,102 @@ import styles from './index.module.less';
// children?: string | JSX.Element;
// };
-type CheckboxState = {
- classes: string;
- check: boolean;
-};
+// type CheckboxState = {
+// classes: string;
+// check: boolean;
+// };
-export class Checkbox extends Component<BaseCheckboxProps, CheckboxState> {
- override state = {
- classes: this.props.className ? `${this.props.className} ${styles.checkBox}` : styles.checkBox,
- check: true,
- };
+// export class Checkbox extends Component<BaseCheckboxProps, CheckboxState> {
+// override state = {
+// classes: this.props.className ? `${this.props.className} ${styles.checkBox}` : styles.checkBox,
+// check: true,
+// };
- handleStyle = (checked?: boolean, disabled?: boolean) => {
- // Decide whether to check or disable based on the checkbox style
- const classGroup = joinClassNames(styles.checkBox, {
- [`${styles.checkBox}-checked`]: checked,
- [`${styles.checkBox}-disabled`]: disabled,
- }) as string;
+// handleStyle = (checked?: boolean, disabled?: boolean) => {
+// // Decide whether to check or disable based on the checkbox style
+// const classGroup = joinClassNames(styles.checkBox, {
+// [`${styles.checkBox}-checked`]: checked,
+// [`${styles.checkBox}-disabled`]: disabled,
+// }) as string;
- this.setState((prevState) => ({ classes: classGroup, check: checked }));
- };
+// this.setState((prevState) => ({ classes: classGroup, check: checked }));
+// };
- override UNSAFE_componentWillMount() {
- this.handleStyle(this.props.checked, this.props.disabled);
- }
+// override UNSAFE_componentWillMount() {
+// this.handleStyle(this.props.checked, this.props.disabled);
+// }
- override UNSAFE_componentWillReceiveProps(nextProps: BaseCheckboxProps) {
- this.handleStyle(nextProps.checked, nextProps.disabled);
- }
+// override UNSAFE_componentWillReceiveProps(nextProps: BaseCheckboxProps) {
+// this.handleStyle(nextProps.checked, nextProps.disabled);
+// }
- handleChange = (e: Event) => {
- const target = e.target as HTMLInputElement;
+// handleChange = (e: Event) => {
+// const target = e.target as HTMLInputElement;
- this.handleStyle(target.checked, this.props.disabled);
+// this.handleStyle(target.checked, this.props.disabled);
- this.props.onChange?.(e);
- };
+// this.props.onChange?.(e);
+// };
- render() {
- const { classes, check } = this.state;
- const { value, name, disabled, children } = this.props;
- return (
- <label className={styles.checkboxWrapper}>
- <span className={classes}>
- <span className={styles.checkboxInner}></span>
- <input type="checkbox" name={name} checked={check} disabled={disabled} className={styles.checkboxInput} value={value} onChange={this.handleChange} />
- </span>
- {children && <span>{children}</span>}
- </label>
- );
- }
+// render() {
+// const { classes, check } = this.state;
+// const { value, name, disabled, children } = this.props;
+// return (
+// <label className={styles.checkboxWrapper}>
+// <span className={classes}>
+// <span className={styles.checkboxInner}></span>
+// <input type="checkbox" name={name} checked={check} disabled={disabled} className={styles.checkboxInput} value={value} onChange={this.handleChange} />
+// </span>
+// {children && <span>{children}</span>}
+// </label>
+// );
+// }
+// }
+export interface BaseCheckboxProps extends BaseComponentProps {
+ value?: string;
+ checked?: boolean;
+ className?: string;
+ disabled?: boolean;
+ name?: string;
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
+ children?: React.ReactNode;
}
-export class UniverCheckbox implements CheckboxComponent {
- render(): JSXComponent<BaseCheckboxProps> {
- return Checkbox;
- }
+export function Checkbox(props: BaseCheckboxProps) {
+ const { className, checked: initialChecked, disabled, name, onChange, children, value } = props;
+
+ const [checked, setChecked] = useState(initialChecked);
+ const [classes, setClasses] = useState(className ? `${className} ${styles.checkBox}` : styles.checkBox);
+
+ useEffect(() => {
+ handleStyle(initialChecked, disabled);
+ }, [initialChecked, disabled]);
+
+ const handleStyle = (isChecked?: boolean, isDisabled?: boolean) => {
+ const classGroup = joinClassNames(styles.checkBox, {
+ [`${styles.checkBox}-checked`]: isChecked,
+ [`${styles.checkBox}-disabled`]: isDisabled,
+ }) as string;
+
+ setClasses(classGroup);
+ };
+
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
+ const { checked: newChecked } = e.target;
+
+ handleStyle(newChecked, disabled);
+ setChecked(newChecked);
+
+ onChange?.(e);
+ };
+
+ return (
+ <label className={styles.checkboxWrapper}>
+ <span className={classes}>
+ <span className={styles.checkboxInner}></span>
+ <input type="checkbox" name={name} checked={checked} disabled={disabled} className={styles.checkboxInput} value={value} onChange={handleChange} />
+ </span>
+ {children && <span>{children}</span>}
+ </label>
+ );
}
diff --git a/packages/base-ui/src/Components/Checkbox/Group.tsx b/packages/base-ui/src/Components/Checkbox/Group.tsx
index f14e6c6645..d2472d0fb7 100644
--- a/packages/base-ui/src/Components/Checkbox/Group.tsx
+++ b/packages/base-ui/src/Components/Checkbox/Group.tsx
@@ -1,25 +1,25 @@
import { useRef } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseCheckboxGroupProps, CheckboxGroupComponent } from '../../Interfaces';
+
+import { BaseComponentProps } from '../../BaseComponent';
import { Checkbox } from './Checkbox';
import styles from './index.module.less';
-// type CheckboxGroupProps = {
-// disabled?: boolean;
-// name?: string;
-// options: Array<options>;
-// onChange?: (value: string[]) => void;
-// };
+export type BaseCheckboxGroupOptions = {
+ checked?: boolean;
+ disabled?: boolean;
+ name?: string;
+ label?: React.ReactNode;
+ value?: string;
+};
-// type options = {
-// checked?: boolean;
-// disabled?: boolean;
-// name?: string;
-// label?: string | JSX.Element;
-// value?: string;
-// };
+export interface BaseCheckboxGroupProps extends BaseComponentProps {
+ disabled?: boolean;
+ name?: string;
+ options: BaseCheckboxGroupOptions[];
+ onChange?: (value: string[]) => void;
+}
-export const CheckboxGroup = (props: BaseCheckboxGroupProps) => {
+export function CheckboxGroup(props: BaseCheckboxGroupProps) {
const { options, onChange, disabled, name } = props;
const ref = useRef<HTMLDivElement>(null);
@@ -56,10 +56,4 @@ export const CheckboxGroup = (props: BaseCheckboxGroupProps) => {
))}
</div>
);
-};
-
-export class UniverCheckboxGroup implements CheckboxGroupComponent {
- render(): JSXComponent<BaseCheckboxGroupProps> {
- return CheckboxGroup;
- }
}
diff --git a/packages/base-ui/src/Components/Collapse/Collapse.tsx b/packages/base-ui/src/Components/Collapse/Collapse.tsx
index 1d7e4d935f..598e55a21c 100644
--- a/packages/base-ui/src/Components/Collapse/Collapse.tsx
+++ b/packages/base-ui/src/Components/Collapse/Collapse.tsx
@@ -1,26 +1,24 @@
-import { useState } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BasePanelProps, BaseCollapseProps, CollapseComponent, PanelComponent } from '../../Interfaces';
+import React, { useState } from 'react';
+
import { joinClassNames } from '../../Utils';
-import { Icon } from '../index';
+import { NextIcon } from '../Icon/Format';
import Style from './index.module.less';
-// interface PanelProps {
-// children: ComponentChildren;
-// header?: ComponentChildren;
-// }
-
-// interface CollapseProps {
-// children: ComponentChildren;
-// }
+export interface BasePanelProps {
+ children: React.ReactNode;
+ header?: React.ReactNode;
+}
-const Panel = (props: BasePanelProps) => {
+export interface BaseCollapseProps {
+ children: React.ReactNode;
+}
+export function Panel(props: BasePanelProps) {
const { header, children } = props;
const [panelBodyClassName, setPanelBodyClassName] = useState(joinClassNames(Style.panelBody));
const handelClick = () => {
- const classname: string | undefined = panelBodyClassName;
- if ((classname as string).includes('active')) {
+ const className: string | undefined = panelBodyClassName;
+ if ((className as string).includes('active')) {
setPanelBodyClassName(joinClassNames(Style.panelBody));
} else {
setPanelBodyClassName(joinClassNames(Style.panelBody, Style.active));
@@ -29,32 +27,19 @@ const Panel = (props: BasePanelProps) => {
return (
<div className={Style.panelWrapper}>
- <div className={Style.panelHeader} onClick={() => handelClick()}>
+ <div className={Style.panelHeader} onClick={handelClick}>
{header}
<span className={`${Style.panelHeaderIcon} ${panelBodyClassName!.includes('active') ? Style.panelHeaderIconRotate : ''}`}>
- <Icon.Format.NextIcon />
+ <NextIcon />
</span>
</div>
<div className={panelBodyClassName}>{children}</div>
</div>
);
-};
+}
-const Collapse = (props: BaseCollapseProps) => {
+export function Collapse(props: BaseCollapseProps) {
const { children } = props;
return <div className={Style.collapseWrapper}>{children}</div>;
-};
-
-export class UniverCollapse implements CollapseComponent {
- render(): JSXComponent<BaseCollapseProps> {
- return Collapse;
- }
}
-export class UniverPanel implements PanelComponent {
- render(): JSXComponent<BasePanelProps> {
- return Panel;
- }
-}
-
-export { Panel, Collapse };
diff --git a/packages/base-ui/src/Components/ColorPicker/ColorPicker.tsx b/packages/base-ui/src/Components/ColorPicker/ColorPicker.tsx
index 98f4b7a8db..127667b4ff 100644
--- a/packages/base-ui/src/Components/ColorPicker/ColorPicker.tsx
+++ b/packages/base-ui/src/Components/ColorPicker/ColorPicker.tsx
@@ -1,11 +1,223 @@
-import { Component, JSX, createRef } from 'react';
-import { BaseColorPickerProps, ColorPickerComponent, JSXComponent } from '../..';
-import { ICustomComponentProps } from '../../services/menu/menu';
+// interface IState {
+// presetColors: string[][];
+// defaultColor: string;
+// afterColor: string;
+// rgb: boolean;
+// setting: boolean;
+// styles?: JSX.CSSProperties;
+// currentLocale: string;
+// root: Element | null;
+// }
+// class ColorPicker extends Component<BaseColorPickerProps & ICustomComponentProps<string>, IState> {
+// ulRef = createRef();
+// constructor(props: BaseColorPickerProps) {
+// super();
+// this.initialize(props);
+// }
+// initialize(props: BaseColorPickerProps) {
+// this.state = {
+// presetColors: allColor,
+// defaultColor: props.color || '#000',
+// afterColor: props.color || '#000',
+// rgb: true,
+// setting: false,
+// styles: {},
+// currentLocale: '',
+// root: null,
+// };
+// }
+// /**
+// * Gets the selected color
+// * @param {string} presetColor new color
+// * @param {boolean} val true:Close color selector
+// */
+// onChange = (presetColor: string) => {
+// this.props.onChange && this.props.onChange(presetColor);
+// this.setState({
+// afterColor: presetColor,
+// });
+// };
+// /**
+// * confirm color
+// *
+// * @eventProperty
+// */
+// onClick = (color: string, e: MouseEvent) => {
+// this.props.onClick?.(color, e);
+// this.props.onValueChange?.(color);
+// };
+// /**
+// * cancel and close
+// *
+// * @eventProperty
+// */
+// onCancel = () => {
+// this.props.onCancel && this.props.onCancel();
+// // this.hideSelect();
+// };
+// hideSelect = (e?: MouseEvent) => {
+// if (e && this.ulRef.current.contains(e.target)) return;
+// this.setState((prevState) => ({ styles: { display: 'none' } }));
+// document.removeEventListener('click', this.hideSelect, true);
+// };
+// showSelect = (root?: Element) => {
+// this.setState((prevState) => ({ styles: { display: 'block' } }));
+// // 点击外部隐藏子组件
+// document.addEventListener('click', this.hideSelect, true);
+// };
+// /**
+// *
+// * @param root Locate according to root
+// * @param ele Element to locate
+// * @returns
+// */
+// getOffset = (root: Element, ele: Element) => {
+// const rootRect = root.getBoundingClientRect();
+// const eleRect = this.ulRef.current.getBoundingClientRect();
+// const w = document.documentElement.clientWidth || document.body.clientWidth;
+// const h = document.documentElement.clientHeight || document.body.clientHeight;
+// let left: number = 0;
+// let top: number = 0;
+// top = rootRect.top + eleRect.height > h ? rootRect.top - eleRect.height : rootRect.top + rootRect.height;
+// left = rootRect.left + eleRect.width > w ? w - eleRect.width : rootRect.left;
+// return { left, top };
+// };
+// /**
+// * Custom switch
+// * @param e
+// */
+// onSwitch = (e: Event) => {
+// e.stopImmediatePropagation();
+// new Promise((resolve, reject) => {
+// this.setState({ setting: !this.state.setting });
+// resolve('end');
+// }).then(() => {
+// if (this.state.root) {
+// const { top, left } = this.getOffset(this.state.root!, this.ulRef.current);
+// this.ulRef.current.style.left = `${left}px`;
+// this.ulRef.current.style.top = `${top}px`;
+// }
+// });
+// };
+// override componentDidMount() {
+// this.props.getComponent?.(this);
+// }
+// render() {
+// const obj = Object.assign(this.state.styles || {}, this.props.style);
+// return (
+// <div className={`${styles.colorPickerOuter} ${this.props.className}`} ref={this.ulRef} style={{ ...obj }}>
+// <div
+// className={styles.colorPicker}
+// onClick={(e: MouseEvent) => {
+// // e.stopImmediatePropagation();
+// }}
+// >
+// <div className={styles.picker}>
+// <div className={styles.pickerSwatches}>
+// {this.state.presetColors.map((presetColor, index) => (
+// <div key={index} className={styles.pickerSwatchesItem}>
+// {presetColor.map((item) => (
+// <span key={item} className={styles.pickerSwatch} style={{ background: item }}>
+// <Tooltip title={item} placement="top">
+// <button
+// key={item}
+// className={styles.pickerSwatchBtn}
+// style={{ background: item }}
+// onClick={(e: MouseEvent) => {
+// this.onClick(item, e);
+// }}
+// />
+// </Tooltip>
+// </span>
+// ))}
+// </div>
+// ))}
+// </div>
+// <div onClick={(e) => e.stopImmediatePropagation()}>
+// <Button onClick={this.onSwitch}>
+// {this.state.setting ? <CustomLabel label="colorPicker.collapse" /> : <CustomLabel label="colorPicker.customColor" />}
+// </Button>
+// </div>
+// </div>
+// {this.state.setting ? (
+// <div className={styles.colorfulWarp}>
+// <ColorPickerPanel color={this.state.defaultColor} rgb={this.state.rgb} onChange={this.onChange.bind(this)} />
+// <div>
+// <Button
+// type="primary"
+// onClick={(e: MouseEvent) => {
+// this.onClick?.(this.state.afterColor, e);
+// // this.hideSelect();
+// }}
+// >
+// <CustomLabel label="colorPicker.confirmColor" />
+// </Button>
+// <Button
+// danger
+// onClick={(e: MouseEvent) => {
+// this.onCancel();
+// }}
+// >
+// <CustomLabel label="colorPicker.cancelColor" />
+// </Button>
+// <Button
+// onClick={(e: MouseEvent) => {
+// e.stopPropagation();
+// this.setState({
+// rgb: !this.state.rgb,
+// });
+// }}
+// >
+// <CustomLabel label="colorPicker.change" />
+// </Button>
+// </div>
+// </div>
+// ) : null}
+// </div>
+// </div>
+// );
+// }
+// }
+import React, { useEffect, useRef, useState } from 'react';
+
+import { BaseComponentProps } from '../../BaseComponent';
+import { CustomLabel } from '../CustomLabel';
import { Button, Tooltip } from '../index';
import { ColorPickerPanel } from './ColorPickerPanel';
-import { CustomLabel } from '../CustomLabel';
import styles from './index.module.less';
+export interface BaseColorPickerProps extends BaseComponentProps {
+ /**
+ * init color
+ */
+ color?: string;
+
+ /**
+ * cancel select
+ */
+ onCancel?: () => void;
+
+ /**
+ * Change colors in real time
+ */
+ onChange?: (color: string, val?: boolean) => void;
+
+ /**
+ * style
+ */
+ style?: React.CSSProperties;
+
+ onClick?: (color: string, e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void; // 返回所选颜色
+ onValueChange?: (value: string) => void; // 返回所选颜色
+
+ /**
+ * class name
+ */
+ className?: string;
+
+ show?: boolean;
+}
+
const allColor = [
['#000', '#444', '#666', '#999', '#ccc', '#eee', '#f3f3f3', '#fff'],
['#f00', '#f90', '#ff0', '#0f0', '#0ff', '#00f', '#90f', '#f0f'],
@@ -15,95 +227,76 @@ const allColor = [
['#c00', '#e69138', '#f1c232', '#6aa84f', '#45818e', '#3d85c6', '#674ea7', '#a64d79'],
['#900', '#b45f06', '#bf9000', '#38761d', '#134f5c', '#0b5394', '#351c75', '#741b47'],
['#600', '#783f04', '#7f6000', '#274e13', '#0c343d', '#073763', '#20124d', '#4c1130'],
-];
-
-interface IState {
- presetColors: string[][];
- defaultColor: string;
- afterColor: string;
- rgb: boolean;
- setting: boolean;
- styles?: JSX.CSSProperties;
- currentLocale: string;
- root: Element | null;
-}
+]; // Replace with your actual styles import
-class ColorPicker extends Component<BaseColorPickerProps & ICustomComponentProps<string>, IState> {
- ulRef = createRef();
-
- constructor(props: BaseColorPickerProps) {
- super();
- this.initialize(props);
- }
-
- initialize(props: BaseColorPickerProps) {
- this.state = {
- presetColors: allColor,
- defaultColor: props.color || '#000',
- afterColor: props.color || '#000',
- rgb: true,
- setting: false,
- styles: {},
- currentLocale: '',
- root: null,
- };
- }
+export function ColorPicker(props: BaseColorPickerProps) {
+ const ulRef = useRef<HTMLDivElement>(null);
- /**
- * Gets the selected color
- * @param {string} presetColor new color
- * @param {boolean} val true:Close color selector
- */
- onChange = (presetColor: string) => {
- this.props.onChange && this.props.onChange(presetColor);
- this.setState({
- afterColor: presetColor,
- });
- };
+ const [presetColors, setPresetColors] = useState(allColor);
+ const [defaultColor, setDefaultColor] = useState(props.color || '#000');
+ const [afterColor, setAfterColor] = useState(props.color || '#000');
+ const [rgb, setRgb] = useState(true);
+ const [setting, setSetting] = useState(false);
+ const [style, setStyles] = useState({});
+ const [currentLocale, setCurrentLocale] = useState('');
+ const [root, setRoot] = useState(null);
+ const [show, setShow] = useState(props.show || false);
- /**
- * confirm color
- *
- * @eventProperty
- */
- onClick = (color: string, e: MouseEvent) => {
- this.props.onClick?.(color, e);
- this.props.onValueChange?.(color);
+ useEffect(() => {
+ setPresetColors(allColor);
+ setDefaultColor(props.color || '#000');
+ setAfterColor(props.color || '#000');
+ setRgb(true);
+ setSetting(false);
+ setStyles({});
+ setCurrentLocale('');
+ setRoot(null);
+ }, [props.color]);
+
+ useEffect(() => {
+ const { show = false } = props;
+ setShow(show);
+
+ if (show) {
+ document.addEventListener('click', hideSelect, true);
+ }
+ }, [props.show]);
+
+ const onChange = (presetColor: string) => {
+ props.onChange && props.onChange(presetColor);
+ setAfterColor(presetColor);
};
- /**
- * cancel and close
- *
- * @eventProperty
- */
- onCancel = () => {
- this.props.onCancel && this.props.onCancel();
- // this.hideSelect();
+ const onClick = (color: string, e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
+ props.onClick?.(color, e);
+ props.onValueChange?.(color);
};
- hideSelect = (e?: MouseEvent) => {
- if (e && this.ulRef.current.contains(e.target)) return;
+ const onCancel = () => {
+ props.onCancel && props.onCancel();
+ };
- this.setState((prevState) => ({ styles: { display: 'none' } }));
+ const hideSelect = (e?: MouseEvent) => {
+ console.info('hide color picker. If it triggers too frequently, it needs to be corrected');
+ if (e && ulRef.current && ulRef.current.contains(e.target as Node)) return;
- document.removeEventListener('click', this.hideSelect, true);
- };
+ setShow(false);
- showSelect = (root?: Element) => {
- this.setState((prevState) => ({ styles: { display: 'block' } }));
- // 点击外部隐藏子组件
- document.addEventListener('click', this.hideSelect, true);
+ document.removeEventListener('click', hideSelect, true);
};
/**
- *
- * @param root Locate according to root
- * @param ele Element to locate
+ * TODO handle ele?
+ * @param root
+ * @param ele
* @returns
*/
- getOffset = (root: Element, ele: Element) => {
+ const getOffset = (root: Element, ele: HTMLDivElement) => {
const rootRect = root.getBoundingClientRect();
- const eleRect = this.ulRef.current.getBoundingClientRect();
+ const eleRect = ulRef.current?.getBoundingClientRect();
+
+ if (!eleRect) return { left: 0, top: 0 };
+
const w = document.documentElement.clientWidth || document.body.clientWidth;
const h = document.documentElement.clientHeight || document.body.clientHeight;
@@ -116,113 +309,89 @@ class ColorPicker extends Component<BaseColorPickerProps & ICustomComponentProps
return { left, top };
};
- /**
- * Custom switch
- * @param e
- */
- onSwitch = (e: Event) => {
+ const onSwitch = (e: Event) => {
e.stopImmediatePropagation();
new Promise((resolve, reject) => {
- this.setState({ setting: !this.state.setting });
+ setSetting(!setting);
resolve('end');
}).then(() => {
- if (this.state.root) {
- const { top, left } = this.getOffset(this.state.root!, this.ulRef.current);
- this.ulRef.current.style.left = `${left}px`;
- this.ulRef.current.style.top = `${top}px`;
+ if (root) {
+ if (!ulRef.current) return;
+ const { top, left } = getOffset(root, ulRef.current);
+ ulRef.current.style.left = `${left}px`;
+ ulRef.current.style.top = `${top}px`;
}
});
};
- override componentDidMount() {
- this.props.getComponent?.(this);
- }
-
- render() {
- const obj = Object.assign(this.state.styles || {}, this.props.style);
-
- return (
- <div className={`${styles.colorPickerOuter} ${this.props.className}`} ref={this.ulRef} style={{ ...obj }}>
- <div
- className={styles.colorPicker}
- onClick={(e: MouseEvent) => {
- // e.stopImmediatePropagation();
- }}
- >
- <div className={styles.picker}>
- <div className={styles.pickerSwatches}>
- {this.state.presetColors.map((presetColor, index) => (
- <div key={index} className={styles.pickerSwatchesItem}>
- {presetColor.map((item) => (
- <span key={item} className={styles.pickerSwatch} style={{ background: item }}>
- <Tooltip title={item} placement="top">
- <button
- key={item}
- className={styles.pickerSwatchBtn}
- style={{ background: item }}
- onClick={(e: MouseEvent) => {
- this.onClick(item, e);
- }}
- />
- </Tooltip>
- </span>
- ))}
- </div>
- ))}
- </div>
- <div onClick={(e) => e.stopImmediatePropagation()}>
- <Button onClick={this.onSwitch}>
- {this.state.setting ? <CustomLabel label="colorPicker.collapse" /> : <CustomLabel label="colorPicker.customColor" />}
- </Button>
- </div>
- </div>
+ useEffect(() => {
+ props.getComponent?.(ulRef.current);
+ }, []);
- {this.state.setting ? (
- <div className={styles.colorfulWarp}>
- <ColorPickerPanel color={this.state.defaultColor} rgb={this.state.rgb} onChange={this.onChange.bind(this)} />
-
- <div>
- <Button
- type="primary"
- onClick={(e: MouseEvent) => {
- this.onClick?.(this.state.afterColor, e);
- // this.hideSelect();
- }}
- >
- <CustomLabel label="colorPicker.confirmColor" />
- </Button>
- <Button
- danger
- onClick={(e: MouseEvent) => {
- this.onCancel();
- }}
- >
- <CustomLabel label="colorPicker.cancelColor" />
- </Button>
- <Button
- onClick={(e: MouseEvent) => {
- e.stopPropagation();
- this.setState({
- rgb: !this.state.rgb,
- });
- }}
- >
- <CustomLabel label="colorPicker.change" />
- </Button>
+ const obj = Object.assign(style || {}, props.style);
+
+ return (
+ <div className={`${styles.colorPickerOuter} ${props.className}`} ref={ulRef} style={{ ...obj, display: show ? 'block' : 'none' }}>
+ <div className={styles.colorPicker}>
+ <div className={styles.picker}>
+ <div className={styles.pickerSwatches}>
+ {presetColors.map((presetColor, index) => (
+ <div key={index} className={styles.pickerSwatchesItem}>
+ {presetColor.map((item) => (
+ <span key={item} className={styles.pickerSwatch} style={{ background: item }}>
+ <Tooltip title={item} placement="top">
+ <button
+ key={item}
+ className={styles.pickerSwatchBtn}
+ style={{ background: item }}
+ onClick={(e) => {
+ onClick(item, e);
+ }}
+ />
+ </Tooltip>
+ </span>
+ ))}
</div>
- </div>
- ) : null}
+ ))}
+ </div>
+ <div
+ onClick={(e) => {
+ e.nativeEvent.stopImmediatePropagation();
+ }}
+ >
+ <Button onClick={onSwitch}>{setting ? <CustomLabel label="colorPicker.collapse" /> : <CustomLabel label="colorPicker.customColor" />}</Button>
+ </div>
</div>
- </div>
- );
- }
-}
-export class UniverColorPicker implements ColorPickerComponent {
- render(): JSXComponent<BaseColorPickerProps> {
- return ColorPicker;
- }
-}
+ {setting ? (
+ <div className={styles.colorfulWarp}>
+ <ColorPickerPanel color={defaultColor} rgb={rgb} onChange={onChange} />
-export { ColorPicker };
+ <div>
+ <Button
+ type="primary"
+ onClick={(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
+ onClick(afterColor, e);
+ }}
+ >
+ <CustomLabel label="colorPicker.confirmColor" />
+ </Button>
+ <Button danger onClick={onCancel}>
+ <CustomLabel label="colorPicker.cancelColor" />
+ </Button>
+ <Button
+ onClick={(e: MouseEvent) => {
+ e.stopPropagation();
+ setRgb(!rgb);
+ }}
+ >
+ <CustomLabel label="colorPicker.change" />
+ </Button>
+ </div>
+ </div>
+ ) : null}
+ </div>
+ </div>
+ );
+}
diff --git a/packages/base-ui/src/Components/ColorPicker/ColorPickerPanel/ColorPickerPanel.tsx b/packages/base-ui/src/Components/ColorPicker/ColorPickerPanel/ColorPickerPanel.tsx
index 1a7e0b7f87..5a118b1a09 100644
--- a/packages/base-ui/src/Components/ColorPicker/ColorPickerPanel/ColorPickerPanel.tsx
+++ b/packages/base-ui/src/Components/ColorPicker/ColorPickerPanel/ColorPickerPanel.tsx
@@ -1,7 +1,7 @@
-import { Component } from 'react';
+import React, { useEffect, useState } from 'react';
import { HexColorInput, RgbaStringColorPicker } from 'react-colorful';
-import { debounce } from '../../../Utils';
+import { debounce } from '../../../Utils';
import { RgbaColorInput } from '../RgbaColorInput';
import styles from './index.module.less';
@@ -11,48 +11,78 @@ interface IProps {
onChange: (color: string) => void;
}
-interface IState {
- color: string;
-}
+// interface IState {
+// color: string;
+// }
+
+// class ColorPickerPanel extends Component<IProps, IState> {
+// constructor(props: IProps) {
+// super();
+// this.initialize(props);
+// }
+
+// initialize(props: IProps) {
+// this.state = {
+// color: props.color || '#000',
+// };
+// }
+
+// setColor(color: string) {
+// this.setState({ color });
+// this.props.onChange(color);
+// }
+
+// render() {
+// return (
+// <div className={styles.colorPickerPanel} onClick={(e) => e.stopPropagation()}>
+// <RgbaStringColorPicker className={styles.colorPicker} color={this.state.color} onChange={debounce(this.setColor.bind(this), 500)} />
+// <div className={styles.colorPickerPanelSetting}>
+// <div className={styles.panelInput}>
+// {this.props.rgb ? (
+// <RgbaColorInput color={this.state.color} onChange={debounce(this.setColor.bind(this), 500)} />
+// ) : (
+// <HexColorInput color={this.state.color} onChange={debounce(this.setColor.bind(this), 500)} />
+// )}
+// </div>
-class ColorPickerPanel extends Component<IProps, IState> {
- constructor(props: IProps) {
- super();
- this.initialize(props);
- }
-
- initialize(props: IProps) {
- this.state = {
- color: props.color || '#000',
- };
- }
-
- setColor(color: string) {
- this.setState({ color });
- this.props.onChange(color);
- }
-
- render() {
- return (
- <div className={styles.colorPickerPanel} onClick={(e) => e.stopPropagation()}>
- <RgbaStringColorPicker className={styles.colorPicker} color={this.state.color} onChange={debounce(this.setColor.bind(this), 500)} />
- <div className={styles.colorPickerPanelSetting}>
- <div className={styles.panelInput}>
- {this.props.rgb ? (
- <RgbaColorInput color={this.state.color} onChange={debounce(this.setColor.bind(this), 500)} />
- ) : (
- <HexColorInput color={this.state.color} onChange={debounce(this.setColor.bind(this), 500)} />
- )}
- </div>
-
- <div className={styles.panelColor}>
- <div style={{ background: this.state.color }}></div>
- <div style={{ background: this.props.color }}></div>
- </div>
+// <div className={styles.panelColor}>
+// <div style={{ background: this.state.color }}></div>
+// <div style={{ background: this.props.color }}></div>
+// </div>
+// </div>
+// </div>
+// );
+// }
+// }
+
+// export { ColorPickerPanel };
+
+export function ColorPickerPanel(props: IProps) {
+ const { color, rgb, onChange } = props;
+ const [currentColor, setCurrentColor] = useState(color || '#000');
+
+ const setColor = (newColor: string) => {
+ setCurrentColor(newColor);
+ onChange(newColor);
+ };
+
+ useEffect(() => {
+ setCurrentColor(color || '#000');
+ }, [color]);
+
+ return (
+ <div className={styles.colorPickerPanel} onClick={(e) => e.stopPropagation()}>
+ <RgbaStringColorPicker className={styles.colorPicker} color={currentColor} onChange={debounce(setColor, 500)} />
+ <div className={styles.colorPickerPanelSetting}>
+ <div className={styles.panelInput}>
+ {rgb ? <RgbaColorInput color={currentColor} onChange={debounce(setColor, 500)} /> : <HexColorInput color={currentColor} onChange={debounce(setColor, 500)} />}
+ </div>
+
+ <div className={styles.panelColor}>
+ <div style={{ background: currentColor }}></div>
+ <div style={{ background: color }}></div>
</div>
</div>
- );
- }
+ </div>
+ );
}
-
-export { ColorPickerPanel };
diff --git a/packages/base-ui/src/Components/ColorPicker/RgbaColorInput/RgbaColorInput.tsx b/packages/base-ui/src/Components/ColorPicker/RgbaColorInput/RgbaColorInput.tsx
index 5b0e39981b..4225fb8512 100644
--- a/packages/base-ui/src/Components/ColorPicker/RgbaColorInput/RgbaColorInput.tsx
+++ b/packages/base-ui/src/Components/ColorPicker/RgbaColorInput/RgbaColorInput.tsx
@@ -1,5 +1,6 @@
import { Color, Nullable } from '@univerjs/core';
import { useRef } from 'react';
+
import { Input } from '../../Input';
interface IProps {
@@ -7,7 +8,7 @@ interface IProps {
onChange: (...arg: any) => void;
}
-export const RgbaColorInput = (props: IProps) => {
+export function RgbaColorInput(props: IProps) {
let { color } = props;
if (!color) return null;
let rgba;
@@ -28,4 +29,4 @@ export const RgbaColorInput = (props: IProps) => {
};
return <Input ref={inputRef} type="text" value={`rgba(${rgba})`} onChange={onChange} />;
-};
+}
diff --git a/packages/base-ui/src/Components/ColorPickerCircleButton/ColorPickerCircleButton.tsx b/packages/base-ui/src/Components/ColorPickerCircleButton/ColorPickerCircleButton.tsx
index 9225610b4f..af2c1f7518 100644
--- a/packages/base-ui/src/Components/ColorPickerCircleButton/ColorPickerCircleButton.tsx
+++ b/packages/base-ui/src/Components/ColorPickerCircleButton/ColorPickerCircleButton.tsx
@@ -1,43 +1,87 @@
-import { Component, createRef } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseColorPickerCircleButtonProps, ColorPickerCircleButtonComponent } from '../../Interfaces';
+import { useRef, useState } from 'react';
+
import { NextIcon } from '../Icon';
import { ColorPicker } from '../index';
import Styles from './index.module.less';
-interface IState {}
+export interface BaseColorPickerCircleButtonProps {
+ /**
+ * init color
+ */
+ color: string;
-/**
- * e2e test,check Components.playwright.test.ts
- */
-export class ColorPickerCircleButton extends Component<BaseColorPickerCircleButtonProps, IState> {
- ref = createRef<HTMLDivElement>();
+ /**
+ * Listen to the confirm button
+ */
+ onClick: (color: string, e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
+ /**
+ * cancel select
+ */
+ onCancel?: () => void;
- colorRef = createRef();
+ /**
+ * style
+ */
+ style?: React.CSSProperties;
+ /**
+ * color picker style
+ */
+ colorPickerStyle?: React.CSSProperties;
+}
+
+// /**
+// * e2e test,check Components.playwright.test.ts
+// */
+// export class ColorPickerCircleButton extends Component<BaseColorPickerCircleButtonProps, IState> {
+// ref = createRef<HTMLDivElement>();
+
+// colorRef = createRef();
+
+// /**
+// * handle ColorSelectButton Click,show color picker
+// */
+// handleColorSelectButtonClick = (e: Event) => {
+// e.stopImmediatePropagation();
+// this.colorRef.current.showSelect(this.ref.current);
+// };
+
+// render() {
+// const { color, onClick, onCancel, style, colorPickerStyle } = this.props;
+
+// return (
+// <div style={style} className={Styles.colorPickerCircleButton} ref={this.ref} onClick={this.handleColorSelectButtonClick}>
+// <span className={`${Styles.colorSelectCircle} ${Styles.verticalMiddle}`} style={{ backgroundColor: color }}></span>
+// <NextIcon className={Styles.verticalMiddle} />
+// <ColorPicker color={color} onClick={onClick} onCancel={onCancel} style={colorPickerStyle} ref={this.colorRef} />
+// </div>
+// );
+// }
+// }
+
+export function ColorPickerCircleButton({ color, onClick, onCancel, style, colorPickerStyle }: BaseColorPickerCircleButtonProps) {
+ const ref = useRef<HTMLDivElement>(null);
+ const [currentColorPickerStyle, setCurrentColorPickerStyle] = useState(colorPickerStyle);
/**
* handle ColorSelectButton Click,show color picker
*/
- handleColorSelectButtonClick = (e: Event) => {
- e.stopImmediatePropagation();
- this.colorRef.current.showSelect(this.ref.current);
- };
+ const handleColorSelectButtonClick = (e: React.MouseEvent<HTMLDivElement>) => {
+ e.nativeEvent.stopImmediatePropagation();
- render() {
- const { color, onClick, onCancel, style, colorPickerStyle } = this.props;
-
- return (
- <div style={style} className={Styles.colorPickerCircleButton} ref={this.ref} onClick={this.handleColorSelectButtonClick}>
- <span className={`${Styles.colorSelectCircle} ${Styles.verticalMiddle}`} style={{ backgroundColor: color }}></span>
- <NextIcon className={Styles.verticalMiddle} />
- <ColorPicker color={color} onClick={onClick} onCancel={onCancel} style={colorPickerStyle} ref={this.colorRef} />
- </div>
- );
- }
-}
+ setCurrentColorPickerStyle({ display: 'block' });
+ };
-export class UniverColorPickerCircleButton implements ColorPickerCircleButtonComponent {
- render(): JSXComponent<BaseColorPickerCircleButtonProps> {
- return ColorPickerCircleButton;
- }
+ return (
+ <div
+ style={style}
+ className={Styles.colorPickerCircleButton} // Make sure to replace Styles with your actual CSS class or styles
+ ref={ref}
+ onClick={handleColorSelectButtonClick}
+ >
+ <span className={`${Styles.colorSelectCircle} ${Styles.verticalMiddle}`} style={{ backgroundColor: color }}></span>
+ <NextIcon className={Styles.verticalMiddle} /> {/* Replace with your NextIcon component */}
+ {/* Replace ColorPicker with your actual ColorPicker component */}
+ <ColorPicker color={color} onClick={onClick} onCancel={onCancel} style={currentColorPickerStyle} />
+ </div>
+ );
}
diff --git a/packages/base-ui/src/Components/Confirm/Confirm.tsx b/packages/base-ui/src/Components/Confirm/Confirm.tsx
index 10840e8aa4..d27df5bbf3 100644
--- a/packages/base-ui/src/Components/Confirm/Confirm.tsx
+++ b/packages/base-ui/src/Components/Confirm/Confirm.tsx
@@ -1,6 +1,59 @@
-import { Component } from 'react';
-import { Modal } from '../Modal';
-import { CustomLabel } from '../CustomLabel';
+// interface IState {
+// show: boolean;
+// }
+// export class Confirm extends Component<BaseConfirmProps, IState> {
+// constructor(props: BaseConfirmProps) {
+// super();
+// this.state = {
+// show: props.show ?? false,
+// };
+// }
+// showModal(show: boolean) {
+// this.setState({
+// show,
+// });
+// }
+// handleClick() {
+// const { onClick } = this.props;
+// onClick?.();
+// this.showModal(false);
+// }
+// getGroup() {
+// const group = [
+// {
+// label: <CustomLabel label="button.confirm" />,
+// type: 'primary',
+// onClick: () => this.handleClick(),
+// },
+// {
+// label: <CustomLabel label="button.cancel" />,
+// onClick: () => this.showModal(false),
+// },
+// ];
+// return group;
+// }
+// override UNSAFE_componentWillReceiveProps(props: BaseConfirmProps): void {
+// if (props.show !== this.props.show) {
+// this.setState({
+// show: props.show,
+// });
+// }
+// }
+// render() {
+// const { title, content } = this.props;
+// const { show } = this.state;
+// return (
+// <div className={styles.confirmModal}>
+// <Modal visible={show} isDrag={true} title={title} group={this.getGroup()}>
+// {content}
+// </Modal>
+// </div>
+// );
+// }
+// }
+import React, { useEffect, useState } from 'react';
+
+import { Modal, ModalButtonGroup } from '../Modal';
import styles from './index.module.less';
interface BaseConfirmProps {
@@ -10,62 +63,36 @@ interface BaseConfirmProps {
show?: boolean;
}
-interface IState {
- show: boolean;
-}
-
-export class Confirm extends Component<BaseConfirmProps, IState> {
- constructor(props: BaseConfirmProps) {
- super();
- this.state = {
- show: props.show ?? false,
- };
- }
+export function Confirm({ title, content, onClick, show = false }: BaseConfirmProps) {
+ const [visible, setVisible] = useState(show);
- showModal(show: boolean) {
- this.setState({
- show,
- });
- }
+ useEffect(() => {
+ setVisible(show);
+ }, [show]);
- handleClick() {
- const { onClick } = this.props;
+ const handleClick = () => {
onClick?.();
- this.showModal(false);
- }
-
- getGroup() {
- const group = [
- {
- label: <CustomLabel label="button.confirm" />,
- type: 'primary',
- onClick: () => this.handleClick(),
- },
- {
- label: <CustomLabel label="button.cancel" />,
- onClick: () => this.showModal(false),
- },
- ];
- return group;
- }
+ setVisible(false);
+ };
- override UNSAFE_componentWillReceiveProps(props: BaseConfirmProps): void {
- if (props.show !== this.props.show) {
- this.setState({
- show: props.show,
- });
- }
- }
+ const getGroup: ModalButtonGroup[] = [
+ {
+ label: 'button.confirm',
+ type: 'primary',
+ onClick: handleClick,
+ },
+ {
+ type: 'default',
+ label: 'button.cancel',
+ onClick: () => setVisible(false),
+ },
+ ];
- render() {
- const { title, content } = this.props;
- const { show } = this.state;
- return (
- <div className={styles.confirmModal}>
- <Modal visible={show} isDrag={true} title={title} group={this.getGroup()}>
- {content}
- </Modal>
- </div>
- );
- }
+ return (
+ <div className={styles.confirmModal}>
+ <Modal visible={visible} isDrag={true} title={title} group={getGroup}>
+ {content}
+ </Modal>
+ </div>
+ );
}
diff --git a/packages/base-ui/src/Components/Container/Container.tsx b/packages/base-ui/src/Components/Container/Container.tsx
index f1280bc053..f0effab1d4 100644
--- a/packages/base-ui/src/Components/Container/Container.tsx
+++ b/packages/base-ui/src/Components/Container/Container.tsx
@@ -1,16 +1,17 @@
-import { ComponentChildren, Ref } from 'react';
-import { forwardRef } from 'react';
+import { forwardRef, Ref } from 'react';
-type IProps = {
- children?: ComponentChildren;
+import { BaseComponentProps } from '../../BaseComponent';
+
+interface BaseContainerProps extends BaseComponentProps {
+ children?: React.ReactNode;
style?: {};
className?: string;
- onClick?: (e: MouseEvent) => void;
- onContextMenu?: (e: MouseEvent) => void;
-};
+ onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
+ onContextMenu?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
+}
-export const Container = forwardRef((props: IProps, ref: Ref<HTMLDivElement>) => {
- const { children, style, className, onClick, onContextMenu } = props;
+export const Container = forwardRef((props: BaseContainerProps, ref: Ref<HTMLDivElement>) => {
+ const { children, style = {}, className = '', onClick, onContextMenu } = props;
return (
<div onContextMenu={onContextMenu} ref={ref} style={style} className={className} onClick={onClick}>
diff --git a/packages/base-ui/src/Components/CustomLabel/CustomLabel.tsx b/packages/base-ui/src/Components/CustomLabel/CustomLabel.tsx
index 98a2647d44..be24a81226 100644
--- a/packages/base-ui/src/Components/CustomLabel/CustomLabel.tsx
+++ b/packages/base-ui/src/Components/CustomLabel/CustomLabel.tsx
@@ -1,14 +1,21 @@
-import { Component, isValidElement, JSX } from 'react';
-import { useContext } from 'react';
+import { isValidElement, JSX, useContext } from 'react';
import { AppContext, AppContextValues, ICustomComponent } from '../../Common';
-import { IBaseCustomLabelProps } from '../../Interfaces';
-import { DisplayTypes } from '../Select';
-
-import styles from './CustomLabel.module.less';
import { IMenuSelectorItem } from '../../services/menu/menu';
-import { Item } from '../Item/Item';
import { Input } from '../Input/input';
+import { Item } from '../Item/Item';
+import { DisplayTypes } from '../Select';
+import styles from './CustomLabel.module.less';
+
+export interface IBaseCustomLabelProps {
+ icon?: string;
+ value?: string;
+ label: string | ICustomComponent | React.ReactNode;
+ display?: DisplayTypes;
+ onChange?: (e: Event) => void;
+ selected?: boolean;
+ title?: string;
+}
function getLocale(context: Partial<AppContextValues>, name: string) {
return context.localeService?.t(name);
@@ -80,7 +87,7 @@ export function CustomLabel(props: IBaseCustomLabelProps): JSX.Element | null {
// the new way to render toolbar item type to replace Label prop
if (display === DisplayTypes.COLOR) {
- return <ColorSelect value={props.label} title={props.label} />;
+ return <ColorSelect value={props.label as string} title={props.label as string} />;
}
if (typeof label === 'string') {
@@ -110,14 +117,22 @@ export interface IColorSelectProps {
value: string;
}
-export class ColorSelect extends Component<IColorSelectProps> {
- render() {
- const { value, icon, title } = this.props;
- return (
- <div className={styles.colorSelect}>
- <div>{icon ? <CustomLabel label={{ name: icon }} /> : title}</div>
- <div className={styles.colorSelectLine} style={{ background: value }}></div>
- </div>
- );
- }
+// export class ColorSelect extends Component<IColorSelectProps> {
+// render() {
+// const { value, icon, title } = this.props;
+// return (
+// <div className={styles.colorSelect}>
+// <div>{icon ? <CustomLabel label={{ name: icon }} /> : title}</div>
+// <div className={styles.colorSelectLine} style={{ background: value }}></div>
+// </div>
+// );
+// }
+// }
+export function ColorSelect({ value, icon, title }: IColorSelectProps) {
+ return (
+ <div className={styles.colorSelect}>
+ <div>{icon ? <CustomLabel label={{ name: icon }} /> : title}</div>
+ <div className={styles.colorSelectLine} style={{ background: value }}></div>
+ </div>
+ );
}
diff --git a/packages/base-ui/src/Components/Drag/Drag-back.tsx b/packages/base-ui/src/Components/Drag/Drag-back.tsx
deleted file mode 100644
index 0979373e26..0000000000
--- a/packages/base-ui/src/Components/Drag/Drag-back.tsx
+++ /dev/null
@@ -1,139 +0,0 @@
-import { Component, createRef } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseDragProps, DragComponent } from '../../Interfaces';
-import styles from './index.module.less';
-
-// interface IProps {
-// isDrag: boolean;
-// }
-interface IState {
- left: string;
- top: string;
- width: number;
- height: number;
- rootW: number;
- rootH: number;
- rootL: number;
- rootT: number;
- offsetX: number;
- offsetY: number;
-}
-
-class Drag extends Component<BaseDragProps, IState> {
- root = createRef();
-
- constructor(props: BaseDragProps) {
- super(props);
- this.initialize();
- }
-
- initialize() {
- this.state = {
- left: '',
- top: '',
- width: 0,
- height: 0,
- rootW: 0,
- rootH: 0,
- rootL: 0,
- rootT: 0,
- offsetX: 0,
- offsetY: 0,
- };
- }
-
- onMouseUp(e: MouseEvent) {
- // e.stopPropagation();
- // this.root.current.removeEventListener('mousemove', this.onMouseMove);
- }
-
- onMouseDown(e: MouseEvent) {
- // e.stopPropagation();
- // if (!((e.target as Element).className === styles.drag)) return;
- const offsetX = e.offsetX;
- const offsetY = e.offsetY;
- this.setState(
- {
- offsetX,
- offsetY,
- },
- () => {
- // this.root.current.addEventListener('mousemove', this.onMouseMove);
- }
- );
- }
-
- onMouseMove = (e: MouseEvent) => {
- // e.stopPropagation();
- const offsetX = this.state.offsetX;
- const offsetY = this.state.offsetY;
-
- // if (e.x === offsetX && e.y === offsetY) return;
-
- const x = e.x;
- const y = e.y;
-
- const left = `${x - offsetX}px`;
- const top = `${y - offsetY}px`;
- this.setState({
- top,
- left,
- });
- };
-
- getWindowRect() {
- const w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
- const h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
- const rootW = this.root.current.offsetWidth;
- const rootH = this.root.current.offsetHeight;
- const rootL = this.root.current.offsetLeft;
- const rootT = this.root.current.offsetTop;
- const top = `${(h - rootH) / 2}px`;
- const left = `${(w - rootW) / 2}px`;
- this.setState({
- width: w,
- height: h,
- rootW,
- rootH,
- rootL,
- rootT,
- top,
- left,
- });
- }
-
- componentDidMount() {
- if (this.props.isDrag) {
- this.getWindowRect();
- }
- }
-
- render() {
- const { isDrag, className = '' } = this.props;
- return (
- <>
- {isDrag ? (
- <div
- ref={this.root}
- className={`${styles.drag} ${className}`}
- style={{ top: this.state.top, left: this.state.left }}
- onMouseUp={this.onMouseUp.bind(this)}
- onMouseDown={this.onMouseDown.bind(this)}
- >
- {this.props.children}
- </div>
- ) : (
- this.props.children
- )}
- </>
- );
- }
-}
-
-export class UniverDrag implements DragComponent {
- render(): JSXComponent<BaseDragProps> {
- return Drag;
- }
-}
-
-export default Drag;
diff --git a/packages/base-ui/src/Components/Drag/Drag.tsx b/packages/base-ui/src/Components/Drag/Drag.tsx
index 635fe42e0c..1b518149af 100644
--- a/packages/base-ui/src/Components/Drag/Drag.tsx
+++ b/packages/base-ui/src/Components/Drag/Drag.tsx
@@ -1,76 +1,189 @@
-import { Component, createRef } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseDragProps, DragComponent } from '../../Interfaces';
+// interface IState {}
+// export interface BaseDragProps {
+// isDrag: boolean;
+// className: string;
+// children: React.ReactNode;
+// }
+// export class Drag extends Component<BaseDragProps, IState> {
+// root = createRef();
+// initDragDialog() {
+// // Drag and drop function (mainly to trigger three events: onpointerdown\onpointermove\onpointerup)
+// const drag = this.root.current;
+// // move to center
+// const { top, left } = this.getPosition();
+// drag.style.top = `${top}px`;
+// drag.style.left = `${left}px`;
+// const divMask = drag.querySelector(`.${styles.dragMask}`);
+// const dragBarTop = drag.querySelector(`.${styles.dragBarTop}`);
+// const dragBarBottom = drag.querySelector(`.${styles.dragBarBottom}`);
+// const dragBarLeft = drag.querySelector(`.${styles.dragBarLeft}`);
+// const dragBarRight = drag.querySelector(`.${styles.dragBarRight}`);
+// dragBarTop.addEventListener('pointerdown', pointerDownListener);
+// dragBarBottom.addEventListener('pointerdown', pointerDownListener);
+// dragBarLeft.addEventListener('pointerdown', pointerDownListener);
+// dragBarRight.addEventListener('pointerdown', pointerDownListener);
+// // When you click on an object, you can use the drag object. Move and up are the global area, that is, the entire document is common. The document object should be used instead of the drag object (otherwise, when the drag object is used, the object can only move to the right or down )
+// function pointerDownListener(e: PointerEvent) {
+// e = e || window.event; // Compatible with IE browser
+// const diffX = e.clientX - drag.offsetLeft; // The distance from the moment the mouse clicks on the object relative to the left border of the object = the distance of the position when clicked relative to the leftmost left of the browser - the distance of the left border of the object relative to the leftmost left of the browser
+// const diffY = e.clientY - drag.offsetTop;
+// /* Low version IE bug: When an object is dragged out of the browser’s visual window, a scroll bar will appear,
+// The solution is to use two unique methods setCapture()\releaseCapture() in IE browser, these two methods,
+// You can let the mouse slide outside the browser to capture the event, and our bug is when the mouse moves out of the browser,
+// The function that the limit is exceeded becomes invalid. In this way, this problem can be solved. Note: These two methods are used in onpointerdown and onpointerup */
+// if (typeof drag.setCapture !== 'undefined') {
+// drag.setCapture();
+// }
+// // Cover the pop-up window
+// divMask.style.width = '100%';
+// divMask.style.height = '100%';
+// // Prevent the selected event from being triggered when the dragging speed is too fast
+// document.body.style.userSelect = 'none';
+// document.addEventListener('pointermove', pointerMoveListener);
+// document.addEventListener('pointerup', pointerUpListener);
+// function pointerMoveListener(e: PointerEvent) {
+// e = e || window.event; // Compatible with IE browser
+// let left = e.clientX - diffX;
+// let top = e.clientY - diffY;
+// // Control the range of dragged objects can only be in the browser window, and scroll bars are not allowed
+// // if (left <0) {
+// // left = 0
+// // } else if (left> window.innerWidth-drag.offsetWidth) {
+// // left = window.innerWidth-drag.offsetWidth
+// // }
+// // if (top <0) {
+// // top = 0
+// // } else if (top> window.innerHeight-drag.offsetHeight) {
+// // top = window.innerHeight-drag.offsetHeight
+// // }
+// if (left < -drag.offsetWidth + 100) {
+// left = -drag.offsetWidth + 100;
+// } else if (left > window.innerWidth - 100) {
+// left = window.innerWidth - 100;
+// }
+// if (top < -drag.offsetHeight + 100) {
+// top = -drag.offsetHeight + 100;
+// } else if (top > window.innerHeight - 100) {
+// top = window.innerHeight - 100;
+// }
+// // Regain the distance of the object when moving, and solve the phenomenon of shaking when dragging
+// drag.style.left = `${left}px`;
+// drag.style.top = `${top}px`;
+// drag.style.transform = '';
+// }
+// function pointerUpListener(e: PointerEvent) {
+// document.removeEventListener('pointermove', pointerMoveListener);
+// document.removeEventListener('pointerup', pointerUpListener);
+// // Prevent the mouse from looping after it pops up (that is, prevent the mouse from moving when it is put on)
+// // Fix low version ie bug
+// if (typeof drag.releaseCapture !== 'undefined') {
+// drag.releaseCapture();
+// }
+// // Restore the hidden mask layer
+// divMask.style.width = '0';
+// divMask.style.height = '0';
+// document.body.style.userSelect = '';
+// }
+// }
+// }
+// getPosition() {
+// const w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
+// const h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
+// const rootW = this.root.current.offsetWidth;
+// const rootH = this.root.current.offsetHeight;
+// const top = (h - rootH) / 2;
+// const left = (w - rootW) / 2;
+// return {
+// top,
+// left,
+// };
+// }
+// componentDidMount() {
+// if (this.props.isDrag) {
+// this.initDragDialog();
+// }
+// }
+// render() {
+// const { isDrag, className = '' } = this.props;
+// return (
+// <>
+// {isDrag ? (
+// <div className={styles.dragContainer}>
+// <div ref={this.root} className={`${styles.dragDialog} ${className}`}>
+// {this.props.children}
+// <div className={styles.dragBarLeft}></div>
+// <div className={styles.dragBarRight}></div>
+// <div className={styles.dragBarTop}></div>
+// <div className={styles.dragBarBottom}></div>
+// <div className={styles.dragMask}></div>
+// </div>
+// </div>
+// ) : (
+// this.props.children
+// )}
+// </>
+// );
+// }
+// }
+import { IKeyValue } from '@univerjs/core';
+import React, { useEffect, useRef } from 'react';
+
import styles from './index.module.less';
-interface IState {}
+interface BaseDragProps {
+ isDrag: boolean;
+ className: string;
+ children: React.ReactNode;
+}
-class Drag extends Component<BaseDragProps, IState> {
- root = createRef();
+export function Drag({ isDrag, className = '', children }: BaseDragProps) {
+ const rootRef = useRef<HTMLDivElement | null>(null);
- initDragDialog() {
- // Drag and drop function (mainly to trigger three events: onpointerdown\onpointermove\onpointerup)
- const drag = this.root.current;
+ const getPosition = () => {
+ const w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
+ const h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
+ const rootW = rootRef.current?.offsetWidth || 0;
+ const rootH = rootRef.current?.offsetHeight || 0;
+ const top = (h - rootH) / 2;
+ const left = (w - rootW) / 2;
- // move to center
- const { top, left } = this.getPosition();
- drag.style.top = `${top}px`;
- drag.style.left = `${left}px`;
+ return {
+ top,
+ left,
+ };
+ };
- const divMask = drag.querySelector(`.${styles.dragMask}`);
+ const initDragDialog = () => {
+ const drag = rootRef.current;
- const dragBarTop = drag.querySelector(`.${styles.dragBarTop}`);
- const dragBarBottom = drag.querySelector(`.${styles.dragBarBottom}`);
- const dragBarLeft = drag.querySelector(`.${styles.dragBarLeft}`);
- const dragBarRight = drag.querySelector(`.${styles.dragBarRight}`);
+ if (!drag) return;
- dragBarTop.addEventListener('pointerdown', pointerDownListener);
- dragBarBottom.addEventListener('pointerdown', pointerDownListener);
- dragBarLeft.addEventListener('pointerdown', pointerDownListener);
- dragBarRight.addEventListener('pointerdown', pointerDownListener);
+ const divMask = drag.querySelector(`.${styles.dragMask}`) as HTMLElement;
- // When you click on an object, you can use the drag object. Move and up are the global area, that is, the entire document is common. The document object should be used instead of the drag object (otherwise, when the drag object is used, the object can only move to the right or down )
+ const dragBarTop = drag.querySelector(`.${styles.dragBarTop}`) as HTMLElement;
+ const dragBarBottom = drag.querySelector(`.${styles.dragBarBottom}`) as HTMLElement;
+ const dragBarLeft = drag.querySelector(`.${styles.dragBarLeft}`) as HTMLElement;
+ const dragBarRight = drag.querySelector(`.${styles.dragBarRight}`) as HTMLElement;
- function pointerDownListener(e: PointerEvent) {
- e = e || window.event; // Compatible with IE browser
- const diffX = e.clientX - drag.offsetLeft; // The distance from the moment the mouse clicks on the object relative to the left border of the object = the distance of the position when clicked relative to the leftmost left of the browser - the distance of the left border of the object relative to the leftmost left of the browser
+ const pointerDownListener = (e: PointerEvent) => {
+ e = e || window.event;
+ const diffX = e.clientX - drag.offsetLeft;
const diffY = e.clientY - drag.offsetTop;
- /* Low version IE bug: When an object is dragged out of the browser’s visual window, a scroll bar will appear,
- The solution is to use two unique methods setCapture()\releaseCapture() in IE browser, these two methods,
- You can let the mouse slide outside the browser to capture the event, and our bug is when the mouse moves out of the browser,
- The function that the limit is exceeded becomes invalid. In this way, this problem can be solved. Note: These two methods are used in onpointerdown and onpointerup */
- if (typeof drag.setCapture !== 'undefined') {
- drag.setCapture();
+ if (typeof (drag as IKeyValue).setCapture !== 'undefined') {
+ (drag as IKeyValue).setCapture();
}
- // Cover the pop-up window
divMask.style.width = '100%';
divMask.style.height = '100%';
- // Prevent the selected event from being triggered when the dragging speed is too fast
document.body.style.userSelect = 'none';
- document.addEventListener('pointermove', pointerMoveListener);
- document.addEventListener('pointerup', pointerUpListener);
-
- function pointerMoveListener(e: PointerEvent) {
- e = e || window.event; // Compatible with IE browser
+ const pointerMoveListener = (e: PointerEvent) => {
+ e = e || window.event;
let left = e.clientX - diffX;
let top = e.clientY - diffY;
- // Control the range of dragged objects can only be in the browser window, and scroll bars are not allowed
- // if (left <0) {
- // left = 0
- // } else if (left> window.innerWidth-drag.offsetWidth) {
- // left = window.innerWidth-drag.offsetWidth
- // }
- // if (top <0) {
- // top = 0
- // } else if (top> window.innerHeight-drag.offsetHeight) {
- // top = window.innerHeight-drag.offsetHeight
- // }
-
if (left < -drag.offsetWidth + 100) {
left = -drag.offsetWidth + 100;
} else if (left > window.innerWidth - 100) {
@@ -82,79 +195,58 @@ class Drag extends Component<BaseDragProps, IState> {
top = window.innerHeight - 100;
}
- // Regain the distance of the object when moving, and solve the phenomenon of shaking when dragging
drag.style.left = `${left}px`;
drag.style.top = `${top}px`;
drag.style.transform = '';
- }
+ };
- function pointerUpListener(e: PointerEvent) {
+ const pointerUpListener = (e: PointerEvent) => {
document.removeEventListener('pointermove', pointerMoveListener);
document.removeEventListener('pointerup', pointerUpListener);
- // Prevent the mouse from looping after it pops up (that is, prevent the mouse from moving when it is put on)
- // Fix low version ie bug
- if (typeof drag.releaseCapture !== 'undefined') {
- drag.releaseCapture();
+ if (typeof (drag as IKeyValue).releaseCapture !== 'undefined') {
+ (drag as IKeyValue).releaseCapture();
}
- // Restore the hidden mask layer
divMask.style.width = '0';
divMask.style.height = '0';
document.body.style.userSelect = '';
- }
- }
- }
+ };
- getPosition() {
- const w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
- const h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
- const rootW = this.root.current.offsetWidth;
- const rootH = this.root.current.offsetHeight;
- const top = (h - rootH) / 2;
- const left = (w - rootW) / 2;
-
- return {
- top,
- left,
+ document.addEventListener('pointermove', pointerMoveListener);
+ document.addEventListener('pointerup', pointerUpListener);
};
- }
- componentDidMount() {
- if (this.props.isDrag) {
- this.initDragDialog();
+ dragBarTop?.addEventListener('pointerdown', pointerDownListener);
+ dragBarBottom?.addEventListener('pointerdown', pointerDownListener);
+ dragBarLeft?.addEventListener('pointerdown', pointerDownListener);
+ dragBarRight?.addEventListener('pointerdown', pointerDownListener);
+ };
+
+ useEffect(() => {
+ if (isDrag) {
+ initDragDialog();
}
- }
-
- render() {
- const { isDrag, className = '' } = this.props;
- return (
- <>
- {isDrag ? (
- <div className={styles.dragContainer}>
- <div ref={this.root} className={`${styles.dragDialog} ${className}`}>
- {this.props.children}
-
- <div className={styles.dragBarLeft}></div>
- <div className={styles.dragBarRight}></div>
- <div className={styles.dragBarTop}></div>
- <div className={styles.dragBarBottom}></div>
-
- <div className={styles.dragMask}></div>
- </div>
- </div>
- ) : (
- this.props.children
- )}
- </>
- );
- }
-}
+ }, [isDrag]);
-export class UniverDrag implements DragComponent {
- render(): JSXComponent<BaseDragProps> {
- return Drag;
- }
-}
+ return (
+ <>
+ {isDrag ? (
+ <div className={styles.dragContainer}>
+ <div ref={rootRef} className={`${styles.dragDialog} ${className}`}>
+ {children}
+
+ <div className={styles.dragBarLeft}></div>
+ <div className={styles.dragBarRight}></div>
+ <div className={styles.dragBarTop}></div>
+ <div className={styles.dragBarBottom}></div>
-export default Drag;
+ <div className={styles.dragMask}></div>
+ </div>
+ </div>
+ ) : (
+ children
+ )}
+ </>
+ );
+}
diff --git a/packages/base-ui/src/Components/Drag/index.ts b/packages/base-ui/src/Components/Drag/index.ts
index e5c3350eb6..813f3459c6 100644
--- a/packages/base-ui/src/Components/Drag/index.ts
+++ b/packages/base-ui/src/Components/Drag/index.ts
@@ -1,3 +1 @@
-import Drag from './Drag';
-
-export { Drag };
+export { Drag } from './Drag';
diff --git a/packages/base-ui/src/Components/Dropdown/Dropdown.tsx b/packages/base-ui/src/Components/Dropdown/Dropdown.tsx
index 4124114584..ab515ac474 100644
--- a/packages/base-ui/src/Components/Dropdown/Dropdown.tsx
+++ b/packages/base-ui/src/Components/Dropdown/Dropdown.tsx
@@ -1,52 +1,155 @@
-import { JSX, createRef, PureComponent } from 'react';
+// interface IState {
+// menuStyle: JSX.CSSProperties;
+// }
+// export class Dropdown extends PureComponent<BaseDropdownProps, IState> {
+// MenuRef = createRef<Menu>();
+// DropRef = createRef<HTMLDivElement>();
+// IconRef = createRef<HTMLDivElement>();
+// constructor(props: BaseDropdownProps) {
+// super(props);
+// this.initialize();
+// }
+// handleClick = (e: MouseEvent) => {
+// this.props.onClick?.();
+// this.props.onMainClick?.();
+// const { icon } = this.props;
+// if (!icon) {
+// this.MenuRef.current?.showMenu(true);
+// }
+// };
+// handleSubClick = () => {
+// this.MenuRef.current?.showMenu(true);
+// };
+// hideMenu = () => {
+// this.MenuRef.current?.showMenu(false);
+// };
+// hideMenuClick = (e: MouseEvent) => {
+// if (!this.DropRef.current || !this.DropRef.current?.contains(e.target as Node)) {
+// this.hideMenu();
+// }
+// };
+// override componentDidMount() {
+// const { placement } = this.props;
+// const style: Record<string, string | number> = { position: 'absolute' };
+// if (!placement || placement === 'Bottom') {
+// style.left = 0;
+// style.top = '100%';
+// } else if (placement === 'Top') {
+// style.left = 0;
+// style.top = '-100%';
+// } else if (placement === 'Left') {
+// style.left = '-100%';
+// style.top = 0;
+// } else {
+// style.left = '100%';
+// style.top = 0;
+// }
+// this.setState({
+// menuStyle: style,
+// });
+// window.addEventListener('click', this.hideMenuClick, true);
+// }
+// override componentWillUnmount() {
+// window.removeEventListener('click', this.hideMenuClick, true);
+// }
+// render() {
+// const { children, menu, showArrow, icon, tooltip, content } = this.props;
+// const { menuStyle } = this.state;
+// return (
+// <div className={styles.dropdown} ref={this.DropRef}>
+// <Tooltip title={tooltip} placement={'bottom'}>
+// <div className={styles.dropContent} onClick={this.handleClick}>
+// {children}
+// {showArrow ? <Icon.Format.NextIcon /> : ''}
+// </div>
+// </Tooltip>
+// {icon && (
+// <div ref={this.IconRef} className={styles.dropIcon} onClick={this.handleSubClick}>
+// {icon}
+// </div>
+// )}
+// {content}
+// <Menu
+// menuId={menu.menuId}
+// options={menu.options}
+// display={menu.display}
+// onClick={menu.onClick}
+// ref={this.MenuRef}
+// value={menu.value}
+// menu={menu.menu}
+// className={menu.className}
+// style={{ ...menu.style, ...menuStyle }}
+// onOptionSelect={(v) => {
+// menu.onOptionSelect?.(v);
+// this.hideMenu();
+// }}
+// ></Menu>
+// </div>
+// );
+// }
+// protected initialize() {
+// this.state = {
+// menuStyle: {},
+// };
+// }
+// }
+import React, { useEffect, useRef, useState } from 'react';
+
import { Icon } from '..';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseDropdownProps, DropdownComponent } from '../../Interfaces';
import { Menu } from '../Menu';
+import { BaseMenuProps } from '../Menu/Menu';
import { Tooltip } from '../Tooltip';
import styles from './index.module.less';
-interface IState {
- menuStyle: JSX.CSSProperties;
+export interface BaseDropdownProps {
+ children: React.ReactNode;
+ /** @deprecated dropdown shouldn't know what is inside */
+ menu: BaseMenuProps;
+ placement?: 'Left' | 'Right' | 'Top' | 'Bottom';
+ showArrow?: boolean;
+ icon?: React.ReactNode;
+ onClick?: () => void;
+ onMainClick?: () => void; //非功能按钮事件
+ tooltip?: string;
+ content?: React.ReactNode;
}
-export class Dropdown extends PureComponent<BaseDropdownProps, IState> {
- MenuRef = createRef<Menu>();
-
- DropRef = createRef<HTMLDivElement>();
-
- IconRef = createRef<HTMLDivElement>();
+export function Dropdown(props: BaseDropdownProps) {
+ // const MenuRef = useRef<Menu>(null);
+ const DropRef = useRef<HTMLDivElement>(null);
+ const IconRef = useRef<HTMLDivElement>(null);
+ const [menuStyle, setMenuStyle] = useState<Record<string, string | number>>({});
+ const [menuShow, setMenuShow] = useState(false);
- constructor(props: BaseDropdownProps) {
- super(props);
- this.initialize();
- }
-
- handleClick = (e: MouseEvent) => {
- this.props.onClick?.();
- this.props.onMainClick?.();
- const { icon } = this.props;
+ const handleClick = () => {
+ props.onClick?.();
+ props.onMainClick?.();
+ const { icon } = props;
if (!icon) {
- this.MenuRef.current?.showMenu(true);
+ // MenuRef.current?.showMenu(true);
+ setMenuShow(true);
}
};
- handleSubClick = () => {
- this.MenuRef.current?.showMenu(true);
+ const handleSubClick = () => {
+ console.info('show');
+ // MenuRef.current?.showMenu(true);
+ setMenuShow(true);
};
- hideMenu = () => {
- this.MenuRef.current?.showMenu(false);
+ const hideMenu = () => {
+ // MenuRef.current?.showMenu(false);
+ setMenuShow(false);
};
- hideMenuClick = (e: MouseEvent) => {
- if (!this.DropRef.current || !this.DropRef.current?.contains(e.target as Node)) {
- this.hideMenu();
+ const hideMenuClick = (e: MouseEvent) => {
+ if (!DropRef.current || !DropRef.current?.contains(e.target as Node)) {
+ hideMenu();
}
};
- override componentDidMount() {
- const { placement } = this.props;
+ useEffect(() => {
+ const { placement } = props;
const style: Record<string, string | number> = { position: 'absolute' };
if (!placement || placement === 'Bottom') {
style.left = 0;
@@ -61,62 +164,43 @@ export class Dropdown extends PureComponent<BaseDropdownProps, IState> {
style.left = '100%';
style.top = 0;
}
- this.setState({
- menuStyle: style,
- });
- window.addEventListener('click', this.hideMenuClick, true);
- }
-
- override componentWillUnmount() {
- window.removeEventListener('click', this.hideMenuClick, true);
- }
+ setMenuStyle(style);
+ window.addEventListener('click', hideMenuClick, true);
- render() {
- const { children, menu, showArrow, icon, tooltip, content } = this.props;
- const { menuStyle } = this.state;
-
- return (
- <div className={styles.dropdown} ref={this.DropRef}>
- <Tooltip title={tooltip} placement={'bottom'}>
- <div className={styles.dropContent} onClick={this.handleClick}>
- {children}
- {showArrow ? <Icon.Format.NextIcon /> : ''}
- </div>
- </Tooltip>
- {icon && (
- <div ref={this.IconRef} className={styles.dropIcon} onClick={this.handleSubClick}>
- {icon}
- </div>
- )}
- {content}
- <Menu
- menuId={menu.menuId}
- options={menu.options}
- display={menu.display}
- onClick={menu.onClick}
- ref={this.MenuRef}
- value={menu.value}
- menu={menu.menu}
- className={menu.className}
- style={{ ...menu.style, ...menuStyle }}
- onOptionSelect={(v) => {
- menu.onOptionSelect?.(v);
- this.hideMenu();
- }}
- ></Menu>
- </div>
- );
- }
-
- protected initialize() {
- this.state = {
- menuStyle: {},
+ return () => {
+ window.removeEventListener('click', hideMenuClick, true);
};
- }
-}
-
-export class UniverDropdown implements DropdownComponent {
- render(): JSXComponent<BaseDropdownProps> {
- return Dropdown;
- }
+ }, [props.placement]);
+ return (
+ <div className={styles.dropdown} ref={DropRef}>
+ <Tooltip title={props.tooltip} placement={'bottom'}>
+ <div className={styles.dropContent} onClick={handleClick}>
+ {props.children}
+ {props.showArrow ? <Icon.Format.NextIcon /> : ''}
+ </div>
+ </Tooltip>
+ {props.icon && (
+ <div ref={IconRef} className={styles.dropIcon} onClick={handleSubClick}>
+ {props.icon}
+ </div>
+ )}
+ {props.content}
+ <Menu
+ menuId={props.menu.menuId}
+ options={props.menu.options}
+ display={props.menu.display}
+ onClick={props.menu.onClick}
+ // ref={MenuRef}
+ value={props.menu.value}
+ menu={props.menu.menu}
+ className={props.menu.className}
+ style={{ ...props.menu.style, ...menuStyle }}
+ onOptionSelect={(v) => {
+ props.menu.onOptionSelect?.(v);
+ hideMenu();
+ }}
+ show={menuShow}
+ ></Menu>
+ </div>
+ );
}
diff --git a/packages/base-ui/src/Components/Grid/Grid.tsx b/packages/base-ui/src/Components/Grid/Grid.tsx
deleted file mode 100644
index b58356914f..0000000000
--- a/packages/base-ui/src/Components/Grid/Grid.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { ComponentChildren } from 'react';
-
-type BaseGridProps = {
- children?: ComponentChildren;
- style?: {};
- className?: string;
- onClick?: (e: MouseEvent) => void;
-};
-
-/**
- * https://stackoverflow.com/questions/56549331/creating-a-flexbox-grid-with-gutters-and-fixed-widths
- * @param props
- * @returns
- */
-export const Grid = (props: BaseGridProps) => {
- const { children, style, className } = props;
-
- return (
- <div className="flexrow">
- <div className="flexcol col-1">THING 1</div>
- <div className="flexcol col-2">THING 2</div>
- <div className="flexcol col-3">THING 3</div>
- <div className="flexcol col-4">THING 4</div>
- <div className="flexcol col-5">THING 5</div>
- <div className="flexcol col-6">THING 6</div>
- </div>
- );
-};
-
-// export class UniverGrid implements GridComponent {
-// render(): JSXComponent<BaseGridProps> {
-// return Grid;
-// }
-// }
diff --git a/packages/base-ui/src/Components/Grid/grid-zh.md b/packages/base-ui/src/Components/Grid/grid-zh.md
deleted file mode 100644
index f104efa10b..0000000000
--- a/packages/base-ui/src/Components/Grid/grid-zh.md
+++ /dev/null
@@ -1,42 +0,0 @@
----
-category: Components
-type: 通用
-title: Container
-subtitle: 容器
-cover: ''
----
-
-## 介绍
-
-通用容器组件,一个容器内可以包含任何其他组件
-
-## API
-
-容器的属性说明如下:
-
-| 属性 | 说明 | 类型 | 默认值 |
-| --------- | --------------------- | --------------------------- | ------ |
-| onClick | 点击按钮时的回调 | `(e: MouseEvent) => void` | - |
-| children | 按钮内容或者子节点 | `ComponentChildren` | - |
-| className | 类名 | `string` | - |
-| styles | 自定义 css 央样式对象 | `JSX.CSSProperties` | - |
-| ref | preact refs 引用 | `RefObject<HTMLDivElement>` | - |
-
-## 案例
-
-```jsx
-import { Container } from '@univerjs/style-univer';
-
-const Toolbar = () => {
- const containerText = 'container';
- return (
- <Container
- onClick={() => {
- this.handleClick();
- }}
- >
- {containerText}
- </Container>
- );
-};
-```
diff --git a/packages/base-ui/src/Components/Grid/grid.md b/packages/base-ui/src/Components/Grid/grid.md
deleted file mode 100644
index 71682e763e..0000000000
--- a/packages/base-ui/src/Components/Grid/grid.md
+++ /dev/null
@@ -1,41 +0,0 @@
----
-category: Components
-type: General
-title: Container
-cover: 'Container'
----
-
-## Introduction
-
-General container components, a container can contain any other components
-
-## API
-
-The properties of the device are described as follows:
-
-| Property | Description | Type | Default Value |
-| --------- | ----------------------------------- | --------------------------- | ------------- |
-| onClick | Callback when the button is clicked | `(e: MouseEvent) => void` | - |
-| children | Button content or child nodes | `ComponentChildren` | - |
-| className | Class name | `string` | - |
-| styles | Custom css central style object | `JSX.CSSProperties` | - |
-| ref | preact refs reference | `RefObject<HTMLDivElement>` | - |
-
-## Case
-
-```jsx
-import { Container } from '@univerjs/style-univer';
-
-const Toolbar = () => {
- const containerText = 'container';
- return (
- <Container
- onClick={() => {
- this.handleClick();
- }}
- >
- {containerText}
- </Container>
- );
-};
-```
diff --git a/packages/base-ui/src/Components/Grid/index.module.less b/packages/base-ui/src/Components/Grid/index.module.less
deleted file mode 100644
index aaa6336282..0000000000
--- a/packages/base-ui/src/Components/Grid/index.module.less
+++ /dev/null
@@ -1,43 +0,0 @@
-@import '../../Basics/CSS/Skin/base.module.less';
-
-.flexrow {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- background: #efefef;
-}
-
-.flexcol {
- width: calc(50% - 5px);
- margin-bottom: 10px;
-
- /* just for visibility */
- border: 1px solid red;
- padding: 20px;
- background: #fff;
- box-sizing: border-box;
-}
-
-.col-1,
-.col-6 {
- width: calc(40% - 5px);
-}
-
-.col-2,
-.col-5 {
- width: calc(60% - 5px);
-}
-
-.col-5,
-.col-6 {
- margin-bottom: 0;
-}
-
-@media (max-width: 992px) {
- .flexcol {
- width: 100%;
- }
- .col-5 {
- margin-bottom: 10px;
- }
-}
diff --git a/packages/base-ui/src/Components/Grid/index.ts b/packages/base-ui/src/Components/Grid/index.ts
deleted file mode 100644
index 762542e7cb..0000000000
--- a/packages/base-ui/src/Components/Grid/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './Grid';
diff --git a/packages/base-ui/src/Components/Grid/test/Grid.test.tsx b/packages/base-ui/src/Components/Grid/test/Grid.test.tsx
deleted file mode 100644
index 5662bbbee9..0000000000
--- a/packages/base-ui/src/Components/Grid/test/Grid.test.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import { render } from '@testing-library/react';
-
-import { Grid } from '..';
-
-describe('Grid', () => {
- test('should display initial Container', () => {
- const { container } = render(<Grid>container content Text</Grid>);
-
- expect(container.textContent).toMatch('container content Text');
- });
-});
diff --git a/packages/base-ui/src/Components/Icon/AddIcon.tsx b/packages/base-ui/src/Components/Icon/AddIcon.tsx
index 08f57394bf..621afdc6e1 100644
--- a/packages/base-ui/src/Components/Icon/AddIcon.tsx
+++ b/packages/base-ui/src/Components/Icon/AddIcon.tsx
@@ -1,21 +1,17 @@
-import { BaseIconProps } from '../../Interfaces';
+import { BaseComponentProps } from '../../BaseComponent';
import { joinClassNames } from '../../Utils';
import styles from './Style/index.module.less';
-// export interface BaseIconProps {
-// spin?: boolean;
-// rotate?: number;
-// style?: JSX.CSSProperties;
-// className?: string;
-// children?: ComponentChildren;
-// name?: string;
-// }
-
-// export interface AddIconProps extends BaseIconProps {
-// children?: ComponentChildren;
-// name?: string;
-// }
-
+export interface BaseIconProps extends BaseComponentProps {
+ spin?: boolean;
+ rotate?: number;
+ style?: React.CSSProperties;
+ className?: string;
+ children?: React.ReactNode;
+ name?: string;
+ width?: string;
+ height?: string;
+}
export const Icon = (props: BaseIconProps) => {
const { spin, rotate, children, name, style, className } = props;
diff --git a/packages/base-ui/src/Components/Icon/Cell/index.tsx b/packages/base-ui/src/Components/Icon/Cell/index.tsx
index 5914e159c5..8c6ea79ddd 100644
--- a/packages/base-ui/src/Components/Icon/Cell/index.tsx
+++ b/packages/base-ui/src/Components/Icon/Cell/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const FillColorIcon = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} name="foward" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/Data/index.tsx b/packages/base-ui/src/Components/Icon/Data/index.tsx
index 79f51baf5b..3bd5351011 100644
--- a/packages/base-ui/src/Components/Icon/Data/index.tsx
+++ b/packages/base-ui/src/Components/Icon/Data/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const PivotableIcon = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} name="foward" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/Delete/index.tsx b/packages/base-ui/src/Components/Icon/Delete/index.tsx
index 8158491374..a8a4b2a39e 100644
--- a/packages/base-ui/src/Components/Icon/Delete/index.tsx
+++ b/packages/base-ui/src/Components/Icon/Delete/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const DeleteIcon = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} name="logo" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/Font/index.tsx b/packages/base-ui/src/Components/Icon/Font/index.tsx
index d234db092b..761c23cec6 100644
--- a/packages/base-ui/src/Components/Icon/Font/index.tsx
+++ b/packages/base-ui/src/Components/Icon/Font/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const BoldIcon = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} name="foward" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/Format/index.tsx b/packages/base-ui/src/Components/Icon/Format/index.tsx
index 153e4961ff..6eac083d47 100644
--- a/packages/base-ui/src/Components/Icon/Format/index.tsx
+++ b/packages/base-ui/src/Components/Icon/Format/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const BackIcon = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} className={props.className} name="foward" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/Insert/index.tsx b/packages/base-ui/src/Components/Icon/Insert/index.tsx
index ea75c7ead9..225f8bf0e0 100644
--- a/packages/base-ui/src/Components/Icon/Insert/index.tsx
+++ b/packages/base-ui/src/Components/Icon/Insert/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const PhotoIcon = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} name="foward" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/Loading/index.tsx b/packages/base-ui/src/Components/Icon/Loading/index.tsx
index a95ed47fee..c361899b63 100644
--- a/packages/base-ui/src/Components/Icon/Loading/index.tsx
+++ b/packages/base-ui/src/Components/Icon/Loading/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const LoadingIcon = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} name="loading" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/Logo/index.tsx b/packages/base-ui/src/Components/Icon/Logo/index.tsx
index f21835285c..593b0d8533 100644
--- a/packages/base-ui/src/Components/Icon/Logo/index.tsx
+++ b/packages/base-ui/src/Components/Icon/Logo/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const LogoIcon = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} name="logo" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/Math/index.tsx b/packages/base-ui/src/Components/Icon/Math/index.tsx
index bb35208f8d..9214eee4ac 100644
--- a/packages/base-ui/src/Components/Icon/Math/index.tsx
+++ b/packages/base-ui/src/Components/Icon/Math/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const AddNumIcon = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} name="foward" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/Other/index.tsx b/packages/base-ui/src/Components/Icon/Other/index.tsx
index 2d47e78bfe..b0ba8c0f81 100644
--- a/packages/base-ui/src/Components/Icon/Other/index.tsx
+++ b/packages/base-ui/src/Components/Icon/Other/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const Close = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} name="logo" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/Sheet/index.tsx b/packages/base-ui/src/Components/Icon/Sheet/index.tsx
index 31a1897c80..7a7fef8f36 100644
--- a/packages/base-ui/src/Components/Icon/Sheet/index.tsx
+++ b/packages/base-ui/src/Components/Icon/Sheet/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const CommentIcon = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} name="foward" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/Text/index.tsx b/packages/base-ui/src/Components/Icon/Text/index.tsx
index 1f9d96505e..d5104cb097 100644
--- a/packages/base-ui/src/Components/Icon/Text/index.tsx
+++ b/packages/base-ui/src/Components/Icon/Text/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const LeftAlignIcon = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} name="foward" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/View/index.tsx b/packages/base-ui/src/Components/Icon/View/index.tsx
index 80879b12e1..b4dedb3717 100644
--- a/packages/base-ui/src/Components/Icon/View/index.tsx
+++ b/packages/base-ui/src/Components/Icon/View/index.tsx
@@ -1,5 +1,4 @@
-import { BaseIconProps } from '../../../Interfaces';
-import { Icon } from '../AddIcon';
+import { BaseIconProps, Icon } from '../AddIcon';
export const PrintIcon = (props: BaseIconProps) => (
<Icon spin={props.spin} rotate={props.rotate} name="foward" style={props.style}>
diff --git a/packages/base-ui/src/Components/Icon/icon.md b/packages/base-ui/src/Components/Icon/icon.md
index 983df79080..59fa7cbfb3 100644
--- a/packages/base-ui/src/Components/Icon/icon.md
+++ b/packages/base-ui/src/Components/Icon/icon.md
@@ -20,7 +20,7 @@ Property Introduction:
| spin | always spin | boolean | false |
| rotate | rotate deg | number | - |
| style | css style | cssStyle | - |
-| className | classname | string | - |
+| className | className | string | - |
## 案例
diff --git a/packages/base-ui/src/Components/Input/input-zh.md b/packages/base-ui/src/Components/Input/input-zh.md
index da1c2dbe2a..295144735f 100644
--- a/packages/base-ui/src/Components/Input/input-zh.md
+++ b/packages/base-ui/src/Components/Input/input-zh.md
@@ -24,7 +24,7 @@ cover: ''
| className | 输入框类名 | string | - |
| id | 输入框 id | string | - |
| value | 输入框 value | string | - |
-| type | 输入框类型 | 'text' | 'button' | 'checkbox' | 'file' | 'hidden' | 'image' | 'password' | 'radio' | 'rest' | 'submit' | - |
+| type | 输入框类型 | 'text' | 'button' | 'checkbox' | 'file' | 'hidden' | 'image' | 'password' | 'radio' | 'reset' | 'submit' | - |
| placeholder | 占位符 | string | - |
| border | 输入框边框 | boolean | true |
| readonly | 输入框是否只读 | boolean | false |
diff --git a/packages/base-ui/src/Components/Input/input.md b/packages/base-ui/src/Components/Input/input.md
index e825e16072..92982f1bfc 100644
--- a/packages/base-ui/src/Components/Input/input.md
+++ b/packages/base-ui/src/Components/Input/input.md
@@ -20,10 +20,10 @@ Property Introduction:
| onFocus | Set the handler to handle `focue` event | (event) => void | - |
| onBlur | Set the handler to handle `blur` event | (event) => void | - |
| onClick | Set the handler to handle `click` event | (event) => void | - |
-| className | input classname | string | - |
+| className | input className | string | - |
| id | input id | string | - |
| value | input value | string | - |
-| type | type of input | 'text' | 'button' | 'checkbox' | 'file' | 'hidden' | 'image' | 'password' | 'radio' | 'rest' | 'submit' | - |
+| type | type of input | 'text' | 'button' | 'checkbox' | 'file' | 'hidden' | 'image' | 'password' | 'radio' | 'reset' | 'submit' | - |
| placeholder | placeholder | string | - |
| border | set border of input | boolean | true |
| readonly | input is readonly | boolean | false |
diff --git a/packages/base-ui/src/Components/Input/input.tsx b/packages/base-ui/src/Components/Input/input.tsx
index 12cb71f4d6..9106291c5f 100644
--- a/packages/base-ui/src/Components/Input/input.tsx
+++ b/packages/base-ui/src/Components/Input/input.tsx
@@ -1,141 +1,110 @@
-import { Component, createRef } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseInputProps, InputComponent } from '../../Interfaces';
-import { joinClassNames } from '../../Utils';
-import styles from './Style/index.module.less';
+import React, { RefObject, useEffect, useMemo, useRef, useState } from 'react';
-// interface InputProps {
-// type?: 'text' | 'button' | 'checkbox' | 'file' | 'hidden' | 'image' | 'password' | 'radio' | 'rest' | 'submit' | 'number';
-// value?: string;
-// placeholder?: string;
-// onChange?: (e: Event) => void;
-// bordered?: boolean;
-// disabled?: boolean;
-// // maxLength?: number;
-// // onPressEnter?: KeyboardEvent;
-// onFocus?: (e: Event) => void;
-// onBlur?: (e: Event) => void;
-// onClick?: (e: MouseEvent) => void;
-// className?: string;
-// readonly?: boolean;
-// id?: string;
-// }
+import { BaseComponentProps } from '../../BaseComponent';
+import { joinClassNames } from '../../Utils/util';
+import styles from './Style/index.module.less';
-type IState = {
+export interface BaseInputProps extends BaseComponentProps {
+ type?: 'text' | 'button' | 'checkbox' | 'file' | 'hidden' | 'image' | 'password' | 'radio' | 'reset' | 'submit' | 'number';
value?: string;
- focused: boolean;
- prevValue?: string;
-};
+ placeholder?: string;
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
+ onPressEnter?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
+ bordered?: boolean;
+ disabled?: boolean;
+ // maxLength?: number;
+ // onPressEnter?: KeyboardEvent;
+ onFocus?: (e: React.FocusEvent<HTMLInputElement, Element>) => void;
+ onBlur?: (e: React.FocusEvent<HTMLInputElement, Element>) => void;
+ onClick?: (e: React.MouseEvent<HTMLInputElement, MouseEvent>) => void;
+ onValueChange?: (value: string) => void;
+ className?: string;
+ readonly?: boolean;
+ id?: string;
+ ref?: RefObject<HTMLInputElement>;
+}
-export class Input extends Component<BaseInputProps, IState> {
- ref = createRef();
+export function Input(props: BaseInputProps) {
+ const ref = useRef<HTMLInputElement>(null);
+ const [value, setValue] = useState(props.value);
+ const [focused, setFocused] = useState(false);
- constructor(props: BaseInputProps) {
- super();
- this.initialize(props);
- }
+ const realValue = useMemo(() => value ?? props.value ?? '', [value, props.value]);
- initialize(props: BaseInputProps) {
- // super(props);
- this.state = {
- value: props.value,
- focused: false,
- };
- }
+ useEffect(() => {
+ if (props.value && props.value !== value) {
+ setValue(props.value);
+ }
+ }, [props.value]);
- setValue = (value: string, callback?: () => void) => {
- this.setState(
- (prevState) => ({
- value,
- }),
- callback
- );
- };
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
+ const { onChange } = props;
+ const target = e.target;
- handleChange = (e: Event) => {
- const { onChange } = this.props;
+ setValue(target.value);
if (!onChange) return;
- const target = e.target as HTMLInputElement;
- this.setValue(target.value);
onChange(e);
};
- handlePressEnter = (e: KeyboardEvent) => {
- const { onPressEnter, onValueChange } = this.props;
+ const handlePressEnter = (e: React.KeyboardEvent<HTMLInputElement>) => {
+ const { onPressEnter, onValueChange } = props;
+ const v = getValue();
+ setValue(v);
if (e.key === 'Enter') {
onPressEnter?.(e);
- this.ref.current.blur();
- onValueChange?.(this.getValue());
+ ref.current?.blur();
+ v && onValueChange?.(v);
}
};
- onFocus = (e: Event) => {
- const { onFocus } = this.props;
+ const onFocus = (e: React.FocusEvent<HTMLInputElement, Element>) => {
+ const { onFocus } = props;
onFocus?.(e);
+ setFocused(true);
};
- onClick = (e: MouseEvent) => {
- const { onClick } = this.props;
- onClick?.(e);
+ const onClick = (e: React.MouseEvent<HTMLInputElement, MouseEvent>) => {
e.stopPropagation();
+ const { onClick } = props;
+ onClick?.(e);
};
- onBlur = (e: FocusEvent) => {
- const { onBlur, onValueChange } = this.props;
+ const onBlur = (e: React.FocusEvent<HTMLInputElement, Element>) => {
+ const { onBlur, onValueChange } = props;
onBlur?.(e);
- onValueChange?.(this.getValue());
+ const v = getValue();
+ v && onValueChange?.(v);
+ setFocused(false);
};
- // get input value
- getValue = () => this.ref.current.value;
-
- UNSAFE_componentWillMount() {
- if (this.props.value) {
- this.setValue(this.props.value);
- }
- }
-
- UNSAFE_componentWillReceiveProps(nextProps: Readonly<BaseInputProps>) {
- if (nextProps.value && nextProps.value !== this.state.value) {
- this.setValue(nextProps.value);
- }
- }
-
- render() {
- const { id, disabled, type, placeholder, bordered = true, className = '', readonly } = this.props;
- const { value } = this.state;
-
- const classes = joinClassNames(
- styles.input,
- {
- [`${styles.input}-disable`]: disabled,
- [`${styles.input}-borderless`]: !bordered,
- },
- className
- );
-
- return (
- <input
- type={type}
- onBlur={this.onBlur}
- onFocus={this.onFocus}
- className={classes}
- placeholder={placeholder}
- disabled={disabled}
- ref={this.ref}
- onChange={this.handleChange}
- value={value}
- onClick={this.onClick}
- readOnly={readonly}
- id={id}
- onKeyUp={this.handlePressEnter}
- ></input>
- );
- }
-}
-
-export class UniverInput implements InputComponent {
- render(): JSXComponent<BaseInputProps> {
- return Input;
- }
+ const getValue = () => ref.current?.value;
+
+ const { id, disabled, type, placeholder, bordered = true, className = '', readonly } = props;
+
+ const classes = joinClassNames(
+ styles.input,
+ {
+ [`${styles.input}-disable`]: disabled,
+ [`${styles.input}-borderless`]: !bordered,
+ },
+ className
+ );
+
+ return (
+ <input
+ type={type}
+ onBlur={onBlur}
+ onFocus={onFocus}
+ className={classes}
+ placeholder={placeholder}
+ disabled={disabled}
+ ref={ref}
+ onChange={handleChange}
+ value={realValue}
+ onClick={onClick}
+ readOnly={readonly}
+ id={id}
+ onKeyUp={handlePressEnter}
+ />
+ );
}
diff --git a/packages/base-ui/src/Components/Input/test/index.test.tsx b/packages/base-ui/src/Components/Input/test/index.test.tsx
index 9d892a5ea6..ccd96b7f57 100644
--- a/packages/base-ui/src/Components/Input/test/index.test.tsx
+++ b/packages/base-ui/src/Components/Input/test/index.test.tsx
@@ -3,32 +3,39 @@ import { fireEvent, render } from '@testing-library/react';
import { Input } from '..';
describe('input', () => {
- test('input', () => {
+ test('render', () => {
const { container } = render(<Input value="test" readonly disabled placeholder="haha" bordered />);
expect(container);
});
+
test('input event', () => {
+ const { container } = render(<Input value="test" placeholder="haha" bordered />);
+ const input = container.querySelector('input');
+ fireEvent.input(input!, { target: { value: '23' } });
+ expect(input!.value).toBe('23');
+ });
+ test('click event', () => {
let a = 1;
- const { container } = render(<Input value="test" readonly onClick={() => a++} disabled placeholder="haha" className="test" />);
+ const { container } = render(<Input value="test" readonly onClick={() => a++} placeholder="haha" className="test" />);
fireEvent.click(document.querySelector('.test')!);
expect(a).toEqual(2);
});
- test('input focue', () => {
+ test('blur event', () => {
let a = 1;
const { container } = render(<Input value="test" readonly onBlur={() => a++} disabled placeholder="haha" className="test" />);
fireEvent.blur(document.querySelector('.test')!);
expect(a).toEqual(2);
});
- test('input blur', () => {
+ test('focus event', () => {
let a = 1;
const { container } = render(<Input value="test" readonly onFocus={() => a++} disabled placeholder="haha" className="test" />);
fireEvent.focus(document.querySelector('.test')!);
expect(a).toEqual(2);
});
- test('input change', () => {
+ test('change event', () => {
let a = 1;
- const { container } = render(<Input value="test" readonly onChange={() => a++} disabled placeholder="haha" className="test" />);
- fireEvent.change(document.querySelector('.test')!);
+ const { container } = render(<Input value="test" onChange={() => a++} placeholder="haha" className="test" />);
+ fireEvent.change(document.querySelector('.test')!, { target: { value: 'new value' } });
expect(a).toEqual(2);
});
});
diff --git a/packages/base-ui/src/Components/Item/Item.tsx b/packages/base-ui/src/Components/Item/Item.tsx
index 3e33c9496f..3b9aa502fd 100644
--- a/packages/base-ui/src/Components/Item/Item.tsx
+++ b/packages/base-ui/src/Components/Item/Item.tsx
@@ -1,41 +1,68 @@
-import { ComponentChildren, Component } from 'react';
-import { BaseMenuItem } from '../../Interfaces';
-import { joinClassNames } from '../../Utils';
+import React from 'react';
+
+import { Icon } from '..';
import { CustomLabel } from '../CustomLabel';
import styles from './index.module.less';
-import { Icon } from '..';
+export interface BaseMenuItem {
+ className?: string;
+ style?: React.CSSProperties;
+ label?: React.ReactNode;
+ value?: any;
+ children?: BaseMenuItem[];
+ show?: boolean;
+ disabled?: boolean;
+ onClick?: (...arg: any) => void;
+ border?: boolean;
+}
export interface BaseItemProps extends BaseMenuItem {
selected?: boolean;
- suffix?: ComponentChildren;
+ suffix?: React.ReactNode;
border?: boolean;
}
+// // TODO@wzhudev: move this component to another proper position. Now used by NeoCustomLabel component.
+// /**
+// * This render as a label of MenuItem.
+// */
+// export class Item extends Component<BaseItemProps> {
+// render() {
+// const { selected, label, suffix, disabled } = this.props;
+// return (
+// <div className={joinClassNames(styles.selectItem, disabled ? styles.selectDisabledItem : '')}>
+// {selected && (
+// <span className={styles.selectItemSelected}>
+// <Icon.CorrectIcon />
+// </span>
+// )}
+// <span className={styles.selectItemContent}>
+// <CustomLabel label={label} />
+// </span>
+// {suffix && (
+// <span className={styles.selectItemSuffix}>
+// <CustomLabel label={suffix} />
+// </span>
+// )}
+// </div>
+// );
+// }
+// }
-// TODO@wzhudev: move this component to another proper position. Now used by NeoCustomLabel component.
-
-/**
- * This render as a label of MenuItem.
- */
-export class Item extends Component<BaseItemProps> {
- render() {
- const { selected, label, suffix, disabled } = this.props;
-
- return (
- <div className={joinClassNames(styles.selectItem, disabled ? styles.selectDisabledItem : '')}>
- {selected && (
- <span className={styles.selectItemSelected}>
- <Icon.CorrectIcon />
- </span>
- )}
- <span className={styles.selectItemContent}>
- <CustomLabel label={label} />
+export function Item({ selected, label, suffix, disabled, className, style, onClick }: BaseItemProps) {
+ return (
+ <div className={`${styles.selectItem} ${disabled ? styles.selectDisabledItem : ''} ${className || ''}`} style={style} onClick={onClick}>
+ {selected && (
+ <span className={styles.selectItemSelected}>
+ <Icon.CorrectIcon />
+ </span>
+ )}
+ <span className={styles.selectItemContent}>
+ <CustomLabel label={label} />
+ </span>
+ {suffix && (
+ <span className={styles.selectItemSuffix}>
+ <CustomLabel label={suffix} />
</span>
- {suffix && (
- <span className={styles.selectItemSuffix}>
- <CustomLabel label={suffix} />
- </span>
- )}
- </div>
- );
- }
+ )}
+ </div>
+ );
}
diff --git a/packages/base-ui/src/Components/Layout/Layout.tsx b/packages/base-ui/src/Components/Layout/Layout.tsx
index 5bd3525295..59df692655 100644
--- a/packages/base-ui/src/Components/Layout/Layout.tsx
+++ b/packages/base-ui/src/Components/Layout/Layout.tsx
@@ -1,56 +1,46 @@
-import { Component, createRef, Ref, forwardRef } from 'react';
-import { BaseLayoutProps } from '../../Interfaces';
-import { getFirstChildren } from '../../Utils';
-import styles from './index.module.less';
-
// Types for props
// type BaseLayoutProps = {
// children?: ComponentChildren;
// className?: string;
// style?: {};
// };
-
// Types for state
-type IState = {
- isAside: boolean;
-};
+import React, { forwardRef, Ref, useEffect, useRef, useState } from 'react';
+
+import { BaseComponentProps } from '../../BaseComponent';
+import { getFirstChildren } from '../../Utils';
+import styles from './index.module.less';
-export class Layout extends Component<BaseLayoutProps, IState> {
- ref = createRef<HTMLTableSectionElement>();
+export interface BaseLayoutProps extends BaseComponentProps {
+ children?: React.ReactNode;
+ className?: string;
+ style?: {};
+}
- state = {
- isAside: false,
- };
+export function Layout({ children, style, className = '' }: BaseLayoutProps) {
+ const [isAside, setIsAside] = useState(false);
+ const ref = useRef<HTMLTableSectionElement>(null);
// If the first child element contains the `aside` component, the layout needs to be changed to horizontal arrangement
- componentDidMount() {
- if (this.ref.current) {
- const children = getFirstChildren(this.ref.current);
+ useEffect(() => {
+ if (ref.current) {
+ const children = getFirstChildren(ref.current);
const childrens = children instanceof Array ? children : [children];
for (const ele of childrens) {
if (ele.tagName === 'ASIDE') {
- this.setState({
- isAside: true,
- });
+ setIsAside(true);
+ break;
}
}
}
- }
+ }, []);
- render() {
- const { children, style, className = '' } = this.props;
- const { isAside } = this.state;
- return (
- <section
- style={style}
- ref={this.ref}
- className={isAside ? `${styles.layoutWrapper} ${styles.layoutWrapperHasSider} ${className}` : `${styles.layoutWrapper} ${className}`}
- >
- {children}
- </section>
- );
- }
+ return (
+ <section style={style} ref={ref} className={isAside ? `${styles.layoutWrapper} ${styles.layoutWrapperHasSider} ${className}` : `${styles.layoutWrapper} ${className}`}>
+ {children}
+ </section>
+ );
}
const Header = (props: BaseLayoutProps) => {
@@ -94,4 +84,4 @@ const Sider = (props: BaseLayoutProps) => {
);
};
-export { Header, Footer, Content, Sider };
+export { Content, Footer, Header, Sider };
diff --git a/packages/base-ui/src/Components/Menu/Menu.tsx b/packages/base-ui/src/Components/Menu/Menu.tsx
index 653400088b..6ffb7b7032 100644
--- a/packages/base-ui/src/Components/Menu/Menu.tsx
+++ b/packages/base-ui/src/Components/Menu/Menu.tsx
@@ -1,83 +1,491 @@
-import { ICommandService, isRealNum } from '@univerjs/core';
-import { Component, createRef, Fragment } from 'react';
+// TODO: this component should have something in common with ToolbarItem
+// export class MenuItem extends Component<IMenuItemProps, IMenuItemState> {
+// static contextType = AppContext;
+// private disabledSubscription: Subscription | undefined;
+// private valueSubscription: Subscription | undefined;
+// private _refs: Menu[] = [];
+// constructor() {
+// super();
+// this.state = {
+// disabled: false,
+// value: undefined,
+// menuItems: [],
+// };
+// }
+// mouseEnter = (e: MouseEvent, index: number) => {
+// this._refs[index]?.showMenu(true);
+// };
+// mouseLeave = (e: MouseEvent, index: number) => {
+// this._refs[index]?.showMenu(false);
+// };
+// override componentDidMount(): void {
+// const { menuItem } = this.props;
+// this.disabledSubscription = menuItem.disabled$?.subscribe((disabled) => {
+// this.setState({ disabled });
+// });
+// this.valueSubscription = menuItem.value$?.subscribe((value) => {
+// this.setState({ value });
+// });
+// this.getSubMenus();
+// }
+// override componentWillUnmount(): void {
+// this.disabledSubscription?.unsubscribe();
+// this.valueSubscription?.unsubscribe();
+// }
+// override UNSAFE_componentWillReceiveProps(nextProps: Readonly<IMenuItemProps>): void {
+// if (this.props.menuItem.id !== nextProps.menuItem.id) {
+// this.getSubMenus();
+// }
+// }
+// handleClick = (e: MouseEvent, item: IDisplayMenuItem<IMenuItem>, index: number) => {
+// const commandService: ICommandService = this.context.injector.get(ICommandService);
+// this.props.onClick();
+// // TODO: type here is not correct
+// const value = this.state.value;
+// // !(item.subMenuItems && item.subMenuItems.length > 0) && commandService.executeCommand(item.id, { value });
+// };
+// /**
+// * user input change value from CustomLabel
+// * @param e
+// */
+// onChange = (v: string | number) => {
+// const value = isRealNum(v) && typeof v === 'string' ? parseInt(v) : v;
+// this.setState({
+// value,
+// });
+// };
+// override render() {
+// switch (this.props.menuItem.type) {
+// case MenuItemType.SELECTOR:
+// return this.renderSelectorType();
+// case MenuItemType.SUBITEMS:
+// return this.renderSubItemsType();
+// default:
+// return this.renderButtonType();
+// }
+// }
+// // button type command should directly execute command
+// private renderButtonType() {
+// const { menuItem, onClick } = this.props;
+// const { disabled, value } = this.state;
+// const { injector } = this.context;
+// const commandService: ICommandService = injector.get(ICommandService);
+// const item = menuItem as IDisplayMenuItem<IMenuButtonItem>;
+// const { title, display, label } = item;
+// return (
+// <li
+// className={joinClassNames(styles.colsMenuitem, disabled ? styles.colsMenuitemDisabled : '')}
+// disabled={disabled}
+// onClick={() => {
+// commandService.executeCommand(item.id, { value: this.state.value });
+// onClick();
+// }}
+// >
+// <NeoCustomLabel
+// display={display}
+// value={value}
+// title={title}
+// label={label}
+// onChange={(v) => {
+// this.onChange(v);
+// // commandService.executeCommand(item.id, { value });
+// // onClick();
+// }}
+// ></NeoCustomLabel>
+// </li>
+// );
+// }
+// private renderSelectorType() {
+// const { menuItem, index } = this.props;
+// const { disabled, menuItems, value } = this.state;
+// const item = menuItem as IDisplayMenuItem<IMenuSelectorItem<unknown>>;
+// const commandService: ICommandService = this.context.injector.get(ICommandService);
+// return (
+// <li
+// className={joinClassNames(styles.colsMenuitem, disabled ? styles.colsMenuitemDisabled : '')}
+// onMouseEnter={(e) => this.mouseEnter(e, index)}
+// onMouseLeave={(e) => this.mouseLeave(e, index)}
+// onClick={(e) => this.handleClick(e, item, index)}
+// >
+// <NeoCustomLabel title={item.title} value={value} onChange={this.onChange} icon={item.icon} display={item.display} label={item.label}></NeoCustomLabel>
+// {item.shortcut && ` (${item.shortcut})`}
+// {(menuItems.length > 0 || (item as IMenuSelectorItem<unknown>).selections?.length) && (
+// <Menu
+// ref={(ele: Menu) => (this._refs[index] = ele)}
+// onOptionSelect={(v) => commandService.executeCommand(item.id, { value: v.value })}
+// menuId={item.id}
+// options={item.selections}
+// display={item.display}
+// parent={this}
+// ></Menu>
+// )}
+// </li>
+// );
+// }
+// private renderSubItemsType() {
+// const { menuItem, index } = this.props;
+// const { disabled, menuItems } = this.state;
+// const item = menuItem as IDisplayMenuItem<IMenuSelectorItem<unknown>>;
+// return (
+// <li
+// className={joinClassNames(styles.colsMenuitem, disabled ? styles.colsMenuitemDisabled : '')}
+// onMouseEnter={(e) => this.mouseEnter(e, index)}
+// onMouseLeave={(e) => this.mouseLeave(e, index)}
+// onClick={(e) => this.handleClick(e, item, index)}
+// >
+// <NeoCustomLabel title={item.title} value={item.title} icon={item.icon} display={item.display} label={item.label}></NeoCustomLabel>
+// {(menuItems.length > 0 || (item as IMenuSelectorItem<unknown>).selections?.length) && (
+// <Menu ref={(ele: Menu) => (this._refs[index] = ele)} menuId={item.id} parent={this} display={item.display}></Menu>
+// )}
+// </li>
+// );
+// }
+// private getSubMenus() {
+// const { menuItem } = this.props;
+// const { id } = menuItem;
+// if (id) {
+// const menuService: IMenuService = this.context.injector.get(IMenuService);
+// this.setState({
+// menuItems: menuService.getMenuItems(id),
+// });
+// }
+// }
+// }
+
+// export class Menu extends Component<BaseMenuProps, IBaseMenuState> {
+// static override contextType = AppContext;
+// private _MenuRef = createRef<HTMLUListElement>();
+// private _refs: Menu[] = [];
+// constructor(props: BaseMenuProps) {
+// super(props);
+// this.initialize();
+// }
+// override componentDidMount(): void {
+// this.getSubMenus();
+// }
+// override UNSAFE_componentWillReceiveProps(nextProps: Readonly<BaseMenuProps>): void {
+// if (this.props.menuId !== nextProps.menuId) {
+// this.getSubMenus();
+// }
+// }
+// getMenuRef = () => this._MenuRef;
+// handleClick = (e: MouseEvent, item: BaseMenuItem, index: number) => {
+// const { deep = 0 } = this.props;
+// item.onClick?.call(null, e, item.value, index, deep);
+// this.props.onClick?.call(null, e, item.value, index, deep);
+// this.showMenu(false);
+// };
+// showMenu = (show: boolean) => {
+// this.setState(
+// (prevState) => ({ show }),
+// () => {
+// this.getStyle();
+// }
+// );
+// };
+// mouseEnter = (e: MouseEvent, index: number) => {
+// const { menu = [] } = this.props;
+// if (menu[index].children) {
+// this._refs[index].showMenu(true);
+// }
+// };
+// mouseLeave = (e: MouseEvent, index: number) => {
+// const { menu = [] } = this.props;
+// if (menu[index].children) {
+// this._refs[index].showMenu(false);
+// }
+// };
+// getStyle = () => {
+// const current = this._MenuRef.current;
+// if (!current) return;
+// const style: BaseMenuStyle = {};
+// const curPosition = current.getBoundingClientRect();
+// let docPosition;
+// const { dom, parent } = this.props;
+// if (dom) {
+// docPosition = dom.getBoundingClientRect();
+// } else {
+// docPosition = {
+// left: 0,
+// right: document.documentElement.clientWidth,
+// top: 0,
+// bottom: document.documentElement.clientHeight,
+// };
+// }
+// // 处理li中包含的ul右边界
+// if (parent) {
+// current.style.position = 'fixed';
+// // 获取固定定位后 父元素正确的位置信息
+// const parPosition = current.parentElement?.getBoundingClientRect();
+// if (!parPosition) return;
+// if (parPosition.right + curPosition.width > docPosition.right) {
+// style.left = `${parPosition.left - curPosition.width}px`;
+// style.top = `${parPosition.top}px`;
+// } else {
+// style.left = `${parPosition.right}px`;
+// style.top = `${parPosition.top}px`;
+// }
+// if (curPosition.bottom > docPosition.bottom) {
+// style.top = 'auto';
+// style.bottom = `5px`;
+// }
+// this.setState({
+// posStyle: style,
+// });
+// }
+// };
+// handleItemClick = (item: IMenuButtonItem) => {
+// this.showMenu(false);
+// };
+// // eslint-disable-next-line max-lines-per-function
+// override render() {
+// const { context, props, state } = this;
+// const { className = '', style = '', menu, deep = 0, options, display, value } = props;
+// const { posStyle, show, menuItems } = state;
+// return (
+// <ul className={joinClassNames(styles.colsMenu, className)} style={{ ...style, ...posStyle, display: show ? 'block' : 'none' }} ref={this._MenuRef}>
+// {/* legacy: render selections */}
+// {menu?.map((item: BaseMenuItem, index: number) => {
+// if (item.show === false) return;
+// return (
+// <Fragment key={index}>
+// <li
+// className={joinClassNames(styles.colsMenuitem, item.className ?? '', item.disabled ? styles.colsMenuitemDisabled : '')}
+// style={item.style}
+// onClick={(e) => this.handleClick(e, item, index)}
+// onMouseEnter={(e) => {
+// this.mouseEnter(e, index);
+// }}
+// onMouseLeave={(e) => {
+// this.mouseLeave(e, index);
+// }}
+// >
+// <CustomLabel label={item.label} />
+// {/* TODO: if the menu itself contains a submenu. It should be served as an `IMenuItem` not wrapped options. */}
+// {item.children ? (
+// <Menu
+// ref={(ele: Menu) => (this._refs[index] = ele)}
+// menu={item.children}
+// onClick={item.onClick}
+// className={item.className}
+// style={item.style}
+// parent={this}
+// deep={deep + 1}
+// ></Menu>
+// ) : (
+// <></>
+// )}
+// </li>
+// {item.border ? <div className={styles.colsMenuitemLine}></div> : ''}
+// </Fragment>
+// );
+// })}
+// {options?.map((option: IValueOption | ICustomComponentOption, index: number) => {
+// // render value option
+// const isValueOption = isValueOptions(option);
+// if (isValueOption) {
+// return (
+// <li
+// key={index}
+// className={joinClassNames(styles.colsMenuitem, option.disabled ? styles.colsMenuitemDisabled : '')}
+// onClick={() => {
+// if (option.value) {
+// this.props.onOptionSelect!(option);
+// }
+// }}
+// >
+// <NeoCustomLabel
+// selected={value === option.value}
+// value={option.value}
+// display={display}
+// label={option.label}
+// title={typeof option.label === 'string' ? option.label : ''}
+// icon={option.icon}
+// />
+// </li>
+// );
+// }
+// // custom component option
+// const CustomComponent = context.componentManager?.get(option.id);
+// return (
+// <li key={index} className={joinClassNames(styles.colsMenuitem, option.disabled ? styles.colsMenuitemDisabled : '')}>
+// <CustomComponent
+// onValueChange={(v: string | number) => {
+// this.props.onOptionSelect!({ value: v, label: option.id });
+// this.showMenu(false);
+// }}
+// />
+// </li>
+// );
+// })}
+// {/* render submenus */}
+// {menuItems?.map((item: IDisplayMenuItem<IMenuItem>, index) => (
+// <MenuItem menuItem={item} key={index} index={index} onClick={this.handleItemClick.bind(this, item as IMenuButtonItem)} />
+// ))}
+// </ul>
+// );
+// }
+// protected initialize() {
+// this.state = {
+// show: false,
+// posStyle: {},
+// menuItems: [],
+// };
+// }
+// private getSubMenus() {
+// const { menuId } = this.props;
+// if (menuId) {
+// const menuService: IMenuService = this.context.injector.get(IMenuService);
+// this.setState({
+// menuItems: menuService.getMenuItems(menuId),
+// });
+// }
+// }
+// }
+import { ICommandService, IKeyValue, isRealNum } from '@univerjs/core';
+import React, { forwardRef, Ref, useContext, useEffect, useState } from 'react';
import { Subscription } from 'rxjs';
import { AppContext } from '../../Common/AppContext';
-import { BaseMenuItem, BaseMenuProps, BaseMenuStyle } from '../../Interfaces';
import { ICustomComponentOption, IDisplayMenuItem, IMenuButtonItem, IMenuItem, IMenuSelectorItem, isValueOptions, IValueOption, MenuItemType } from '../../services/menu/menu';
import { IMenuService } from '../../services/menu/menu.service';
import { joinClassNames } from '../../Utils';
import { CustomLabel, NeoCustomLabel } from '../CustomLabel/CustomLabel';
+import { BaseMenuItem } from '../Item/Item';
+import { DisplayTypes } from '../Select/Select';
import styles from './index.module.less';
-export interface IBaseMenuState {
- show: boolean;
- posStyle: BaseMenuStyle;
- menuItems: Array<IDisplayMenuItem<IMenuItem>>;
+export interface BaseMenuProps {
+ /** @deprecated */
+ onClick?: (...arg: any) => void;
+ /** @deprecated */
+ className?: string;
+ /** @deprecated */
+ style?: React.CSSProperties;
+ /** @deprecated */
+ parent?: any;
+ /** @deprecated */
+ dom?: HTMLElement;
+ /** @deprecated */
+ ref?: any;
+ /** @deprecated */
+ deep?: number;
+ /** @deprecated this is legacy menu mechanism. Do not use it. Use `menuItems` instead. */
+ menu?: BaseMenuItem[]; // TODO: should be renamed to `items`
+
+ // NOTE: options above are legacy. They are going to be removed after we complete refactoring.
+
+ display?: DisplayTypes;
+ menuId?: string;
+ value?: string | number;
+ options?: Array<IValueOption | ICustomComponentOption>;
+ onOptionSelect?: (option: IValueOption) => void;
+ show?: boolean;
}
-export class Menu extends Component<BaseMenuProps, IBaseMenuState> {
- static override contextType = AppContext;
-
- private _MenuRef = createRef<HTMLUListElement>();
-
- private _refs: Menu[] = [];
-
- constructor(props: BaseMenuProps) {
- super(props);
- this.initialize();
- }
-
- override componentDidMount(): void {
- this.getSubMenus();
- }
-
- override UNSAFE_componentWillReceiveProps(nextProps: Readonly<BaseMenuProps>): void {
- if (this.props.menuId !== nextProps.menuId) {
- this.getSubMenus();
- }
- }
-
- getMenuRef = () => this._MenuRef;
-
- handleClick = (e: MouseEvent, item: BaseMenuItem, index: number) => {
- const { deep = 0 } = this.props;
-
- item.onClick?.call(null, e, item.value, index, deep);
- this.props.onClick?.call(null, e, item.value, index, deep);
- this.showMenu(false);
+export type BaseMenuState = {
+ show: boolean;
+ posStyle: BaseMenuStyle;
+};
+
+export type BaseMenuStyle = {
+ left?: string;
+ right?: string;
+ top?: string;
+ bottom?: string;
+};
+
+// export interface IBaseMenuState {
+// show: boolean;
+// posStyle: BaseMenuStyle;
+// menuItems: Array<IDisplayMenuItem<IMenuItem>>;
+// } // Replace with your utility function import
+
+// interface IValueOption {
+// value: string | number;
+// label: string;
+// icon?: string;
+// disabled?: boolean;
+// }
+
+// interface ICustomComponentOption {
+// id: string;
+// disabled?: boolean;
+// }
+
+// interface BaseMenuItem {
+// show?: boolean;
+// className?: string;
+// style?: React.CSSProperties;
+// label: string;
+// children?: BaseMenuItem[];
+// border?: boolean;
+// disabled?: boolean;
+// onClick?: (e: MouseEvent, value: string | number, index: number, deep: number) => void;
+// }
+
+// type DisplayTypes = 'block' | 'inline' | 'none';
+
+// type BaseMenuStyle = React.CSSProperties;
+
+// interface BaseMenuProps {
+// display?: DisplayTypes;
+// menuId?: string;
+// value?: string | number;
+// options?: Array<IValueOption | ICustomComponentOption>;
+// onOptionSelect?: (option: IValueOption) => void;
+// }
+
+// TODODushusir remove forwardRef
+export const Menu = forwardRef((props: BaseMenuProps, MenuRef: Ref<HTMLUListElement>) => {
+ const { display, menuId, value, options, onOptionSelect, dom, parent, onClick, deep = 0, menu = [], className = '', style = {}, show = false } = props;
+ const context = useContext(AppContext);
+ const [isShow, setIsShow] = useState(show);
+ const [posStyle, setPosStyle] = useState<BaseMenuStyle>({});
+ const [menuItems, setMenuItems] = useState<Array<IDisplayMenuItem<IMenuItem>>>([]);
+ // const MenuRef = useRef<HTMLUListElement | null>(null);
+ // const refs: Array<React.RefObject<Menu>> = []; // FIXME type error
+ const refs: Array<React.RefObject<IKeyValue>> = [];
+
+ useEffect(() => {
+ getSubMenus();
+ }, [menuId]);
+
+ useEffect(() => {
+ const { show = false } = props;
+ setIsShow(show);
+ }, [show]);
+
+ const handleClick = (e: MouseEvent, item: BaseMenuItem, index: number) => {
+ item.onClick?.call(null, e, item.label, index, deep);
+ onClick?.call(null, e, item.value, index, deep);
+ setIsShow(false);
};
- showMenu = (show: boolean) => {
- this.setState(
- (prevState) => ({ show }),
- () => {
- this.getStyle();
- }
- );
+ const showMenu = (show: boolean) => {
+ setIsShow(show);
+ getStyle();
};
- mouseEnter = (e: MouseEvent, index: number) => {
- const { menu = [] } = this.props;
- if (menu[index].children) {
- this._refs[index].showMenu(true);
+ const mouseEnter = (e: MouseEvent, index: number) => {
+ if (menu[index] && menu[index].hasOwnProperty('children')) {
+ refs[index].current?.showMenu(true);
}
};
- mouseLeave = (e: MouseEvent, index: number) => {
- const { menu = [] } = this.props;
- if (menu[index].children) {
- this._refs[index].showMenu(false);
+ const mouseLeave = (e: MouseEvent, index: number) => {
+ if (menu[index] && menu[index].hasOwnProperty('children')) {
+ refs[index].current?.showMenu(false);
}
};
- getStyle = () => {
- const current = this._MenuRef.current;
+ const getStyle = () => {
+ const current = (MenuRef as IKeyValue).current;
if (!current) return;
const style: BaseMenuStyle = {};
const curPosition = current.getBoundingClientRect();
let docPosition;
- const { dom, parent } = this.props;
+
if (dom) {
docPosition = dom.getBoundingClientRect();
} else {
@@ -89,10 +497,8 @@ export class Menu extends Component<BaseMenuProps, IBaseMenuState> {
};
}
- // 处理li中包含的ul右边界
if (parent) {
current.style.position = 'fixed';
- // 获取固定定位后 父元素正确的位置信息
const parPosition = current.parentElement?.getBoundingClientRect();
if (!parPosition) return;
if (parPosition.right + curPosition.width > docPosition.right) {
@@ -106,125 +512,71 @@ export class Menu extends Component<BaseMenuProps, IBaseMenuState> {
style.top = 'auto';
style.bottom = `5px`;
}
- this.setState({
- posStyle: style,
- });
+ setPosStyle(style);
}
};
- handleItemClick = (item: IMenuButtonItem) => {
- this.showMenu(false);
+ const handleItemClick = (item: IMenuButtonItem) => {
+ showMenu(false);
};
- // eslint-disable-next-line max-lines-per-function
- override render() {
- const { context, props, state } = this;
- const { className = '', style = '', menu, deep = 0, options, display, value } = props;
- const { posStyle, show, menuItems } = state;
- return (
- <ul className={joinClassNames(styles.colsMenu, className)} style={{ ...style, ...posStyle, display: show ? 'block' : 'none' }} ref={this._MenuRef}>
- {/* legacy: render selections */}
- {menu?.map((item: BaseMenuItem, index: number) => {
- if (item.show === false) return;
- return (
- <Fragment key={index}>
- <li
- className={joinClassNames(styles.colsMenuitem, item.className ?? '', item.disabled ? styles.colsMenuitemDisabled : '')}
- style={item.style}
- onClick={(e) => this.handleClick(e, item, index)}
- onMouseEnter={(e) => {
- this.mouseEnter(e, index);
- }}
- onMouseLeave={(e) => {
- this.mouseLeave(e, index);
- }}
- >
- <CustomLabel label={item.label} />
- {/* TODO: if the menu itself contains a submenu. It should be served as an `IMenuItem` not wrapped options. */}
- {item.children ? (
- <Menu
- ref={(ele: Menu) => (this._refs[index] = ele)}
- menu={item.children}
- onClick={item.onClick}
- className={item.className}
- style={item.style}
- parent={this}
- deep={deep + 1}
- ></Menu>
- ) : (
- <></>
- )}
- </li>
- {item.border ? <div className={styles.colsMenuitemLine}></div> : ''}
- </Fragment>
- );
- })}
- {options?.map((option: IValueOption | ICustomComponentOption, index: number) => {
- // render value option
- const isValueOption = isValueOptions(option);
- if (isValueOption) {
- return (
- <li
- key={index}
- className={joinClassNames(styles.colsMenuitem, option.disabled ? styles.colsMenuitemDisabled : '')}
- onClick={() => {
- if (option.value) {
- this.props.onOptionSelect!(option);
- }
- }}
- >
- <NeoCustomLabel
- selected={value === option.value}
- value={option.value}
- display={display}
- label={option.label}
- title={typeof option.label === 'string' ? option.label : ''}
- icon={option.icon}
- />
- </li>
- );
- }
-
- // custom component option
- const CustomComponent = context.componentManager?.get(option.id);
+ const getSubMenus = () => {
+ if (menuId) {
+ const menuService = context.injector?.get(IMenuService); // Assuming context is available
+ if (!menuService) {
+ throw new Error('menuService is not defined');
+ }
+ setMenuItems(menuService.getMenuItems(menuId));
+ }
+ };
+
+ return (
+ <ul className={joinClassNames(styles.colsMenu, className)} style={{ ...style, ...posStyle, display: isShow ? 'block' : 'none' }} ref={MenuRef}>
+ {/* legacy: render selections */}
+ {options?.map((option: IValueOption | ICustomComponentOption, index: number) => {
+ const isValueOption = isValueOptions(option);
+ if (isValueOption) {
return (
- <li key={index} className={joinClassNames(styles.colsMenuitem, option.disabled ? styles.colsMenuitemDisabled : '')}>
- <CustomComponent
- onValueChange={(v: string | number) => {
- this.props.onOptionSelect!({ value: v, label: option.id });
- this.showMenu(false);
- }}
+ <li
+ key={index}
+ className={joinClassNames(styles.colsMenuitem, option.disabled ? styles.colsMenuitemDisabled : '')}
+ onClick={() => {
+ if (option.value) {
+ onOptionSelect?.(option);
+ }
+ }}
+ >
+ <CustomLabel
+ selected={value === option.value}
+ value={String(option.value)}
+ display={display}
+ label={option.label}
+ title={typeof option.label === 'string' ? option.label : ''}
+ icon={option.icon}
/>
</li>
);
- })}
- {/* render submenus */}
- {menuItems?.map((item: IDisplayMenuItem<IMenuItem>, index) => (
- <MenuItem menuItem={item} key={index} index={index} onClick={this.handleItemClick.bind(this, item as IMenuButtonItem)} />
- ))}
- </ul>
- );
- }
-
- protected initialize() {
- this.state = {
- show: false,
- posStyle: {},
- menuItems: [],
- };
- }
-
- private getSubMenus() {
- const { menuId } = this.props;
-
- if (menuId) {
- const menuService: IMenuService = this.context.injector.get(IMenuService);
- this.setState({
- menuItems: menuService.getMenuItems(menuId),
- });
- }
- }
-}
+ }
+
+ const CustomComponent = context.componentManager?.get(option.id) as React.ComponentType<any>;
+ return (
+ <li key={index} className={joinClassNames(styles.colsMenuitem, option.disabled ? styles.colsMenuitemDisabled : '')}>
+ <CustomComponent
+ onValueChange={(v: string | number) => {
+ onOptionSelect?.({ value: v, label: option.id });
+ showMenu(false);
+ }}
+ />
+ </li>
+ );
+ })}
+ {/* render submenus */}
+ {menuItems?.map((item: IDisplayMenuItem<IMenuItem>, index) => (
+ <MenuItem menuItem={item} key={index} index={index} onClick={() => handleItemClick(item as IMenuButtonItem)} />
+ ))}
+ </ul>
+ );
+});
export interface IMenuItemProps {
menuItem: IDisplayMenuItem<IMenuItem>;
@@ -238,66 +590,38 @@ export interface IMenuItemState {
value: any;
}
-// TODO: this component should have something in common with ToolbarItem
-
-export class MenuItem extends Component<IMenuItemProps, IMenuItemState> {
- static contextType = AppContext;
-
- private disabledSubscription: Subscription | undefined;
-
- private valueSubscription: Subscription | undefined;
-
- private _refs: Menu[] = [];
-
- constructor() {
- super();
-
- this.state = {
- disabled: false,
- value: undefined,
- menuItems: [],
- };
- }
-
- mouseEnter = (e: MouseEvent, index: number) => {
- this._refs[index]?.showMenu(true);
+export function MenuItem({ menuItem, index, onClick }: IMenuItemProps) {
+ const context = useContext(AppContext);
+ const [disabled, setDisabled] = useState(false);
+ const [value, setValue] = useState<any>(undefined);
+ const [menuItems, setMenuItems] = useState<Array<IDisplayMenuItem<IMenuItem>>>([]);
+ const [disabledSubscription, setDisabledSubscription] = useState<Subscription | undefined>();
+ const [valueSubscription, setValueSubscription] = useState<Subscription | undefined>();
+ // const _refs: Menu[] = [];
+ const _refs: IKeyValue[] = [];
+
+ const mouseEnter = (e: React.MouseEvent<HTMLLIElement, MouseEvent>, index: number) => {
+ _refs[index]?.showMenu(true);
};
- mouseLeave = (e: MouseEvent, index: number) => {
- this._refs[index]?.showMenu(false);
+ const mouseLeave = (e: React.MouseEvent<HTMLLIElement, MouseEvent>, index: number) => {
+ _refs[index]?.showMenu(false);
};
- override componentDidMount(): void {
- const { menuItem } = this.props;
-
- this.disabledSubscription = menuItem.disabled$?.subscribe((disabled) => {
- this.setState({ disabled });
- });
-
- this.valueSubscription = menuItem.value$?.subscribe((value) => {
- this.setState({ value });
- });
-
- this.getSubMenus();
- }
-
- override componentWillUnmount(): void {
- this.disabledSubscription?.unsubscribe();
- this.valueSubscription?.unsubscribe();
- }
+ const getSubMenus = () => {
+ const { id } = menuItem;
- override UNSAFE_componentWillReceiveProps(nextProps: Readonly<IMenuItemProps>): void {
- if (this.props.menuItem.id !== nextProps.menuItem.id) {
- this.getSubMenus();
+ if (id) {
+ const menuService = context.injector?.get(IMenuService);
+ menuService && setMenuItems(menuService.getMenuItems(id));
}
- }
+ };
- handleClick = (e: MouseEvent, item: IDisplayMenuItem<IMenuItem>, index: number) => {
- const commandService: ICommandService = this.context.injector.get(ICommandService);
- this.props.onClick();
+ const handleClick = (e: React.MouseEvent<HTMLLIElement, MouseEvent>, item: IDisplayMenuItem<IMenuItem>, index: number) => {
+ // const commandService: ICommandService = context.injector.get(ICommandService);
+ onClick();
- // TODO: type here is not correct
- const value = this.state.value;
+ const itemValue = value;
// !(item.subMenuItems && item.subMenuItems.length > 0) && commandService.executeCommand(item.id, { value });
};
@@ -305,41 +629,48 @@ export class MenuItem extends Component<IMenuItemProps, IMenuItemState> {
* user input change value from CustomLabel
* @param e
*/
- onChange = (v: string | number) => {
- const value = isRealNum(v) && typeof v === 'string' ? parseInt(v) : v;
+ const onChange = (v: string | number) => {
+ const newValue = isRealNum(v) && typeof v === 'string' ? parseInt(v) : v;
- this.setState({
- value,
- });
+ setValue(newValue);
};
- override render() {
- switch (this.props.menuItem.type) {
- case MenuItemType.SELECTOR:
- return this.renderSelectorType();
- case MenuItemType.SUBITEMS:
- return this.renderSubItemsType();
- default:
- return this.renderButtonType();
- }
- }
+ useEffect(() => {
+ setDisabledSubscription(
+ menuItem.disabled$?.subscribe((disabled) => {
+ setDisabled(disabled);
+ })
+ );
+
+ setValueSubscription(
+ menuItem.value$?.subscribe((newValue) => {
+ setValue(newValue);
+ })
+ );
- // button type command should directly execute command
- private renderButtonType() {
- const { menuItem, onClick } = this.props;
- const { disabled, value } = this.state;
- const { injector } = this.context;
+ getSubMenus();
- const commandService: ICommandService = injector.get(ICommandService);
+ return () => {
+ disabledSubscription?.unsubscribe();
+ valueSubscription?.unsubscribe();
+ };
+ }, [menuItem]);
+
+ const renderButtonType = () => {
+ const { injector } = context;
+ const commandService = injector?.get(ICommandService);
+ if (!commandService) {
+ throw new Error('commandService is not defined');
+ }
const item = menuItem as IDisplayMenuItem<IMenuButtonItem>;
const { title, display, label } = item;
return (
<li
className={joinClassNames(styles.colsMenuitem, disabled ? styles.colsMenuitemDisabled : '')}
- disabled={disabled}
+ // disabled={disabled} // FIXME disabled is not working
onClick={() => {
- commandService.executeCommand(item.id, { value: this.state.value });
+ commandService.executeCommand(item.id, { value });
onClick();
}}
>
@@ -349,73 +680,70 @@ export class MenuItem extends Component<IMenuItemProps, IMenuItemState> {
title={title}
label={label}
onChange={(v) => {
- this.onChange(v);
+ onChange(v);
// commandService.executeCommand(item.id, { value });
// onClick();
}}
></NeoCustomLabel>
</li>
);
- }
+ };
- private renderSelectorType() {
- const { menuItem, index } = this.props;
- const { disabled, menuItems, value } = this.state;
+ const renderSelectorType = () => {
const item = menuItem as IDisplayMenuItem<IMenuSelectorItem<unknown>>;
- const commandService: ICommandService = this.context.injector.get(ICommandService);
+ const commandService = context.injector?.get(ICommandService);
+
+ if (!commandService) {
+ throw new Error('commandService is not defined');
+ }
return (
<li
className={joinClassNames(styles.colsMenuitem, disabled ? styles.colsMenuitemDisabled : '')}
- onMouseEnter={(e) => this.mouseEnter(e, index)}
- onMouseLeave={(e) => this.mouseLeave(e, index)}
- onClick={(e) => this.handleClick(e, item, index)}
+ onMouseEnter={(e) => mouseEnter(e, index)}
+ onMouseLeave={(e) => mouseLeave(e, index)}
+ onClick={(e) => handleClick(e, item, index)}
>
- <NeoCustomLabel title={item.title} value={value} onChange={this.onChange} icon={item.icon} display={item.display} label={item.label}></NeoCustomLabel>
+ <NeoCustomLabel title={item.title} value={value} onChange={onChange} icon={item.icon} display={item.display} label={item.label}></NeoCustomLabel>
{item.shortcut && ` (${item.shortcut})`}
{(menuItems.length > 0 || (item as IMenuSelectorItem<unknown>).selections?.length) && (
<Menu
- ref={(ele: Menu) => (this._refs[index] = ele)}
+ ref={(ele: HTMLUListElement) => (_refs[index] = ele)}
onOptionSelect={(v) => commandService.executeCommand(item.id, { value: v.value })}
menuId={item.id}
options={item.selections}
display={item.display}
- parent={this}
+ // parent={this}
></Menu>
)}
</li>
);
- }
+ };
- private renderSubItemsType() {
- const { menuItem, index } = this.props;
- const { disabled, menuItems } = this.state;
+ const renderSubItemsType = () => {
const item = menuItem as IDisplayMenuItem<IMenuSelectorItem<unknown>>;
return (
<li
className={joinClassNames(styles.colsMenuitem, disabled ? styles.colsMenuitemDisabled : '')}
- onMouseEnter={(e) => this.mouseEnter(e, index)}
- onMouseLeave={(e) => this.mouseLeave(e, index)}
- onClick={(e) => this.handleClick(e, item, index)}
+ onMouseEnter={(e) => mouseEnter(e, index)}
+ onMouseLeave={(e) => mouseLeave(e, index)}
+ onClick={(e) => handleClick(e, item, index)}
>
<NeoCustomLabel title={item.title} value={item.title} icon={item.icon} display={item.display} label={item.label}></NeoCustomLabel>
{(menuItems.length > 0 || (item as IMenuSelectorItem<unknown>).selections?.length) && (
- <Menu ref={(ele: Menu) => (this._refs[index] = ele)} menuId={item.id} parent={this} display={item.display}></Menu>
+ // <Menu ref={(ele: Menu) => (_refs[index] = ele)} menuId={item.id} parent={this} display={item.display}></Menu>
+ <Menu ref={(ele: HTMLUListElement) => (_refs[index] = ele)} menuId={item.id} display={item.display}></Menu>
)}
</li>
);
- }
-
- private getSubMenus() {
- const { menuItem } = this.props;
- const { id } = menuItem;
+ };
- if (id) {
- const menuService: IMenuService = this.context.injector.get(IMenuService);
- this.setState({
- menuItems: menuService.getMenuItems(id),
- });
- }
- }
+ return (
+ <>
+ {menuItem.type === MenuItemType.SELECTOR && renderSelectorType()}
+ {menuItem.type === MenuItemType.SUBITEMS && renderSubItemsType()}
+ {menuItem.type !== MenuItemType.SELECTOR && menuItem.type !== MenuItemType.SUBITEMS && renderButtonType()}
+ </>
+ );
}
diff --git a/packages/base-ui/src/Components/Modal/Modal.tsx b/packages/base-ui/src/Components/Modal/Modal.tsx
index 2f1eeb5d3f..0cebb0ab33 100644
--- a/packages/base-ui/src/Components/Modal/Modal.tsx
+++ b/packages/base-ui/src/Components/Modal/Modal.tsx
@@ -1,120 +1,204 @@
-import { Component } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseModalProps, ModalComponent } from '../../Interfaces';
+// class Modal extends Component<BaseModalProps, IState> {
+// constructor(props: BaseModalProps) {
+// super(props);
+// this.initialize();
+// }
+// initialize() {
+// this.state = {
+// visible: this.props.visible ?? false,
+// };
+// }
+// handleClickCancel = (cb: Function | undefined) => {
+// // this.setState({ visible: false });
+// if (cb) cb();
+// };
+// showModal = (value: boolean) => {
+// this.setState((prevState) => ({
+// visible: value,
+// }));
+// };
+// override UNSAFE_componentWillReceiveProps(props: BaseModalProps) {
+// if (props.visible !== this.state.visible) {
+// this.setState({
+// visible: props.visible,
+// });
+// }
+// }
+// handleClick = (cb?: () => void) => {
+// this.showModal(false);
+// if (cb) cb();
+// };
+// render() {
+// const { title, width = 500, top = 0, style, children, className = '', group = [], isDrag = false, mask = true, footer = true } = this.props;
+// const { visible } = this.state;
+// return (
+// <>
+// {visible ? (
+// <div className={className}>
+// {mask ? (
+// <div
+// className={styles.modalMask}
+// onClick={(e) => {
+// this.props.onCancel?.(e);
+// this.showModal(false);
+// }}
+// ></div>
+// ) : null}
+// <Drag isDrag={isDrag} className={styles.modalDrag}>
+// <div
+// className={`${isDrag ? styles.modalDargWrapper : styles.modalWrapper}`}
+// style={{
+// width: `${width}px`,
+// // top: `${top}px`,
+// ...style,
+// }}
+// >
+// <div className={styles.modalHeader}>
+// <span>{title}</span>
+// <span
+// className={styles.modalClose}
+// onClick={(e) => {
+// this.props.onCancel?.(e);
+// this.showModal(false);
+// }}
+// >
+// <Icon.Other.Close></Icon.Other.Close>
+// </span>
+// </div>
+// <div className={styles.modalBody}>{children}</div>
+// {footer ? (
+// <div className={styles.modalFooter}>
+// {group.map((item, index) => (
+// <Button key={index} type={item.type} onClick={() => this.handleClick(item.onClick)}>
+// <CustomLabel label={item.label} />
+// </Button>
+// ))}
+// </div>
+// ) : null}
+// </div>
+// </Drag>
+// </div>
+// ) : null}
+// </>
+// );
+// }
+// }
+import React, { useEffect, useState } from 'react';
+
import { Button } from '../Button';
+import { ButtonType } from '../Button/Button';
+import { CustomLabel } from '../CustomLabel';
import { Drag } from '../Drag';
import * as Icon from '../Icon';
-import { CustomLabel } from '../CustomLabel';
import styles from './index.module.less';
-interface IState {
- visible: boolean;
+export interface BaseModalProps {
+ title?: string | JSX.Element;
+ width?: number;
+ top?: number;
+ style?: React.CSSProperties;
+ children?: React.ReactNode;
+ className?: string;
+ group?: ModalButtonGroup[];
+ maskClick?: () => void;
+ /** 模态框是否可以拖动 */
+ isDrag?: boolean;
+
+ /** 模态框是否可见 */
+ visible?: boolean;
+
+ /** 是否显示遮罩 */
+ mask?: boolean;
+
+ /** 是否显示底部 */
+ footer?: boolean;
+
+ /** 点击遮罩层或右上角叉或取消按钮的回调 */
+ onCancel?: (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
+ ref?: any;
}
-class Modal extends Component<BaseModalProps, IState> {
- constructor(props: BaseModalProps) {
- super(props);
- this.initialize();
- }
+export interface ModalButtonGroup {
+ type: ButtonType;
+ onClick: () => void;
+ label: string;
+}
- initialize() {
- this.state = {
- visible: this.props.visible ?? false,
- };
- }
+export interface ModalProps extends BaseModalProps {
+ show?: boolean;
+ locale?: string;
+}
- handleClickCancel = (cb: Function | undefined) => {
- // this.setState({ visible: false });
- if (cb) cb();
- };
+export function Modal(props: BaseModalProps) {
+ const { title, width = 500, top = 0, style, children, className = '', group = [], isDrag = false, mask = true, footer = true, onCancel, visible: propsVisible } = props;
- showModal = (value: boolean) => {
- this.setState((prevState) => ({
- visible: value,
- }));
- };
+ const [visible, setVisible] = useState<boolean>(propsVisible || false);
- override UNSAFE_componentWillReceiveProps(props: BaseModalProps) {
- if (props.visible !== this.state.visible) {
- this.setState({
- visible: props.visible,
- });
- }
- }
+ useEffect(() => {
+ setVisible(propsVisible || false);
+ }, [propsVisible]);
- // maskClick = (e: MouseEvent) => {
- // const mask = document.querySelector(`.${styles.modalMask}`);
- // if (e.target === mask) {
- // this.showModal(false);
- // this.props.maskClick?.();
- // }
+ // const handleClickCancel = (cb: Function | undefined) => {
+ // if (cb) cb();
// };
- handleClick = (cb?: () => void) => {
- this.showModal(false);
- if (cb) cb();
+
+ const showModal = (value: boolean) => {
+ setVisible(value);
};
- render() {
- const { title, width = 500, top = 0, style, children, className = '', group = [], isDrag = false, mask = true, footer = true } = this.props;
- const { visible } = this.state;
+ const handleClick = (cb?: () => void) => {
+ setVisible(false);
+ if (cb) cb();
+ };
- return (
- <>
- {visible ? (
- <div className={className}>
- {mask ? (
- <div
- className={styles.modalMask}
- onClick={(e) => {
- this.props.onCancel?.(e);
- this.showModal(false);
- }}
- ></div>
- ) : null}
- <Drag isDrag={isDrag} className={styles.modalDrag}>
- <div
- className={`${isDrag ? styles.modalDargWrapper : styles.modalWrapper}`}
- style={{
- width: `${width}px`,
- // top: `${top}px`,
- ...style,
- }}
- >
- <div className={styles.modalHeader}>
- <span>{title}</span>
- <span
- className={styles.modalClose}
- onClick={(e) => {
- this.props.onCancel?.(e);
- this.showModal(false);
- }}
- >
- <Icon.Other.Close></Icon.Other.Close>
- </span>
- </div>
- <div className={styles.modalBody}>{children}</div>
- {footer ? (
- <div className={styles.modalFooter}>
- {group.map((item, index) => (
- <Button key={index} type={item.type} onClick={() => this.handleClick(item.onClick)}>
- <CustomLabel label={item.label} />
- </Button>
- ))}
- </div>
- ) : null}
+ return (
+ <>
+ {visible ? (
+ <div className={className}>
+ {mask ? (
+ <div
+ className={styles.modalMask}
+ onClick={(e) => {
+ onCancel?.(e);
+ showModal(false);
+ }}
+ ></div>
+ ) : null}
+ <Drag isDrag={isDrag} className={styles.modalDrag}>
+ <div
+ className={`${isDrag ? styles.modalDargWrapper : styles.modalWrapper}`}
+ style={{
+ width: `${width}px`,
+ // top: `${top}px`,
+ ...style,
+ }}
+ >
+ <div className={styles.modalHeader}>
+ <span>{title}</span>
+ <span
+ className={styles.modalClose}
+ onClick={(e) => {
+ onCancel?.(e);
+ showModal(false);
+ }}
+ >
+ <Icon.Other.Close></Icon.Other.Close>
+ </span>
</div>
- </Drag>
- </div>
- ) : null}
- </>
- );
- }
-}
-
-export class UniverModal implements ModalComponent {
- render(): JSXComponent<BaseModalProps> {
- return Modal;
- }
+ <div className={styles.modalBody}>{children}</div>
+ {footer ? (
+ <div className={styles.modalFooter}>
+ {group.map((item, index) => (
+ <Button key={index} type={item.type} onClick={() => handleClick(item.onClick)}>
+ <CustomLabel label={item.label} />
+ </Button>
+ ))}
+ </div>
+ ) : null}
+ </div>
+ </Drag>
+ </div>
+ ) : null}
+ </>
+ );
}
-
-export { Modal };
diff --git a/packages/base-ui/src/Components/Modal/test/index.test.tsx b/packages/base-ui/src/Components/Modal/test/index.test.tsx
deleted file mode 100644
index b33b70edad..0000000000
--- a/packages/base-ui/src/Components/Modal/test/index.test.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { render, screen } from '@testing-library/react';
-
-import { Modal } from '..';
-
-describe('Modal', () => {
- const title = 'title';
- const div = <div>btn</div>;
- const modal = (
- <Modal visible={true} title={title}>
- {div}
- </Modal>
- );
- test('Find Modal title', async () => {
- render(modal);
-
- // fireEvent.click(screen.getByText('1'));
-
- expect(screen.getByText('btn'));
- });
-});
diff --git a/packages/base-ui/src/Components/Prompt/Prompt.tsx b/packages/base-ui/src/Components/Prompt/Prompt.tsx
index b5e2129af9..218b66fa7d 100644
--- a/packages/base-ui/src/Components/Prompt/Prompt.tsx
+++ b/packages/base-ui/src/Components/Prompt/Prompt.tsx
@@ -1,8 +1,76 @@
-import { Component } from 'react';
-import { Modal } from '../Modal';
+import React, { useEffect, useState } from 'react';
+
import { CustomLabel } from '../CustomLabel';
+import { Modal, ModalButtonGroup } from '../Modal';
import styles from './index.module.less';
+// interface BaseConfirmProps {
+// title: string;
+// content: string;
+// onClick?: () => void;
+// show?: boolean;
+// }
+
+// interface IState {
+// show: boolean;
+// }
+
+// export class Prompt extends Component<BaseConfirmProps, IState> {
+// constructor(props: BaseConfirmProps) {
+// super();
+// this.state = {
+// show: props.show ?? false,
+// };
+// }
+
+// showModal(show: boolean) {
+// this.setState({
+// show,
+// });
+// }
+
+// handleClick() {
+// const { onClick } = this.props;
+// onClick?.();
+// this.showModal(false);
+// }
+
+// getGroup() {
+// const group = [
+// {
+// label: 'button.confirm',
+// type: 'primary',
+// onClick: () => this.handleClick(),
+// },
+// {
+// label: 'button.cancel',
+// onClick: () => this.showModal(false),
+// },
+// ];
+// return group;
+// }
+
+// UNSAFE_componentWillReceiveProps(props: BaseConfirmProps): void {
+// if (props.show !== this.props.show) {
+// this.setState({
+// show: props.show,
+// });
+// }
+// }
+
+// render() {
+// const { title, content } = this.props;
+// const { show } = this.state;
+// return (
+// <div className={styles.confirmModal}>
+// <Modal visible={show} isDrag={true} title={<CustomLabel label={title} />} group={this.getGroup()}>
+// <CustomLabel label={content} />
+// </Modal>
+// </div>
+// );
+// }
+// }
+
interface BaseConfirmProps {
title: string;
content: string;
@@ -10,62 +78,45 @@ interface BaseConfirmProps {
show?: boolean;
}
-interface IState {
- show: boolean;
-}
+export function Prompt(props: BaseConfirmProps) {
+ const [show, setShow] = useState<boolean>(props.show ?? false);
-export class Prompt extends Component<BaseConfirmProps, IState> {
- constructor(props: BaseConfirmProps) {
- super();
- this.state = {
- show: props.show ?? false,
- };
- }
-
- showModal(show: boolean) {
- this.setState({
- show,
- });
- }
-
- handleClick() {
- const { onClick } = this.props;
+ const showModal = (show: boolean) => {
+ setShow(show);
+ };
+
+ const handleClick = () => {
+ const { onClick } = props;
onClick?.();
- this.showModal(false);
- }
-
- getGroup() {
- const group = [
- {
- label: <CustomLabel label="button.confirm" />,
- type: 'primary',
- onClick: () => this.handleClick(),
- },
- {
- label: <CustomLabel label="button.cancel" />,
- onClick: () => this.showModal(false),
- },
- ];
- return group;
- }
-
- UNSAFE_componentWillReceiveProps(props: BaseConfirmProps): void {
- if (props.show !== this.props.show) {
- this.setState({
- show: props.show,
- });
+ setShow(false);
+ };
+
+ const getGroup: ModalButtonGroup[] = [
+ {
+ label: 'button.confirm',
+ type: 'primary',
+ onClick: () => handleClick(),
+ },
+ {
+ type: 'default',
+ label: 'button.cancel',
+ onClick: () => showModal(false),
+ },
+ ];
+
+ useEffect(() => {
+ if (props.show !== show) {
+ setShow(props.show ?? false);
}
- }
-
- render() {
- const { title, content } = this.props;
- const { show } = this.state;
- return (
- <div className={styles.confirmModal}>
- <Modal visible={show} isDrag={true} title={<CustomLabel label={title} />} group={this.getGroup()}>
- <CustomLabel label={content} />
- </Modal>
- </div>
- );
- }
+ }, [props.show]);
+
+ const { title, content } = props;
+
+ return (
+ <div className={styles.confirmModal}>
+ <Modal visible={show} isDrag={true} title={<CustomLabel label={title} />} group={getGroup}>
+ <CustomLabel label={content} />
+ </Modal>
+ </div>
+ );
}
diff --git a/packages/base-ui/src/Components/Radio/Radio.tsx b/packages/base-ui/src/Components/Radio/Radio.tsx
index c1edcabd29..9022526510 100644
--- a/packages/base-ui/src/Components/Radio/Radio.tsx
+++ b/packages/base-ui/src/Components/Radio/Radio.tsx
@@ -1,84 +1,62 @@
-import { Component, VNode, cloneElement } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseRadioGroupProps, BaseRadioIProps, RadioComponent } from '../../Interfaces';
+import React from 'react';
+
import styles from './index.module.less';
-// interface IProps {
-// value: string;
-// active?: boolean;
-// onClick?: () => void;
-// label?: string;
-// }
-interface IState {}
+export interface BaseRadioIProps {
+ value: string;
+ active?: boolean;
+ onClick?: (value: string) => void;
+ label?: string;
+ children?: React.ReactNode[];
+}
-// interface RadioGroupProps {
-// className?: string;
-// active: string | number;
-// vertical?: boolean;
-// onChange: (value: string) => void;
-// children: Array<VNode<IProps>>;
-// }
+export interface BaseRadioGroupProps {
+ className?: string;
+ active?: string | number;
+ vertical?: boolean;
+ onChange: (value: string) => void;
+ children: React.ReactNode[];
+}
-class RadioGroup extends Component<BaseRadioGroupProps, IState> {
- handleActiveChange(value: string) {
- this.props.onChange(value);
- }
+export function RadioGroup(props: BaseRadioGroupProps) {
+ const { vertical, className = '', active, onChange } = props;
- render() {
- const { vertical, className = '' } = this.props;
- return (
- <div className={`${vertical ? styles.radioGroup : ''} ${className || ''}`}>
- {this.props.children.map((item: VNode<BaseRadioIProps>, index) => {
- const isActive = this.props.active === item.props.value;
- /**
- *
- * Use item as VNode
- *
- * fix : No overload matches this call.
- Overload 1 of 2, '(vnode: VNode<any>, props?: any, ...children: ComponentChildren[]): VNode<any>', gave the following error.
- Argument of type 'Radio & ComponentChildren' is not assignable to parameter of type 'VNode<any>'.
- */
- return cloneElement(item, {
+ const handleActiveChange = (value: string) => {
+ onChange(value);
+ };
+
+ return (
+ <div className={`${vertical ? styles.radioGroup : ''} ${className || ''}`}>
+ {React.Children.map(props.children, (child, index) => {
+ if (React.isValidElement<BaseRadioIProps>(child)) {
+ const isActive = active === child.props.value;
+ return React.cloneElement(child, {
key: index,
- label: item.props.label,
- children: item.props.children,
- value: item.props.value,
+ label: child.props.label,
+ children: child.props.children,
+ value: child.props.value,
active: isActive,
- onClick: this.handleActiveChange.bind(this),
+ onClick: handleActiveChange,
});
- })}
- </div>
- );
- }
+ }
+ return child;
+ })}
+ </div>
+ );
}
-class Radio extends Component<BaseRadioIProps, IState> {
- render() {
- return (
- <div className={styles.radioWrap}>
- <div className={styles.radioLeft}>
- <div onClick={this.props.onClick!.bind(this, this.props.value)}>
- <div className={`${styles.circle} ${this.props.active && styles.active}`}>
- <div className={styles.fork}></div>
- </div>
- <div className={styles.label}>{this.props.label}</div>
+export function Radio({ value, active, onClick, label, children }: BaseRadioIProps) {
+ return (
+ <div className={styles.radioWrap}>
+ <div className={styles.radioLeft}>
+ <div onClick={onClick && (() => onClick(value))}>
+ <div className={`${styles.circle} ${active && styles.active}`}>
+ <div className={styles.fork}></div>
</div>
- {this.props.children}
+ <div className={styles.label}>{label}</div>
</div>
+ {children}
</div>
- );
- }
+ </div>
+ );
}
-
-export class UniverRadio implements RadioComponent {
- render(): JSXComponent<BaseRadioIProps> {
- return Radio;
- }
-}
-export class UniverRadioGroup implements RadioComponent {
- render(): JSXComponent<BaseRadioIProps> {
- return Radio;
- }
-}
-
-export { RadioGroup, Radio };
diff --git a/packages/base-ui/src/Components/Radio/index.ts b/packages/base-ui/src/Components/Radio/index.ts
index d6ccd228a2..d6b1a462c0 100644
--- a/packages/base-ui/src/Components/Radio/index.ts
+++ b/packages/base-ui/src/Components/Radio/index.ts
@@ -1,3 +1 @@
-import { UniverRadio, UniverRadioGroup, Radio, RadioGroup } from './Radio';
-
-export { RadioGroup, Radio, UniverRadio, UniverRadioGroup };
+export { Radio, RadioGroup } from './Radio';
diff --git a/packages/base-ui/src/Components/ResizeDialog/ResizeDialog.tsx b/packages/base-ui/src/Components/ResizeDialog/ResizeDialog.tsx
index c72ba7eb96..6ae3cc84dc 100644
--- a/packages/base-ui/src/Components/ResizeDialog/ResizeDialog.tsx
+++ b/packages/base-ui/src/Components/ResizeDialog/ResizeDialog.tsx
@@ -1,10 +1,20 @@
import { useEffect, useRef } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseResizeDialogProps, ResizeDialogComponent } from '../../Interfaces';
+
+import { BaseComponentProps } from '../../BaseComponent';
import styles from './index.module.less';
+export interface BaseResizeDialogProps extends BaseComponentProps {
+ left: number;
+ top: number;
+ width: number;
+ height: number;
+ children: React.ReactNode;
+ ratio: number;
+}
+
export const ResizeDialog = (props: BaseResizeDialogProps) => {
- let { left = 0, top = 0, width = 100, height = 50, children, ratio = 1 } = props;
+ let { left = 0, top = 0 } = props;
+ const { width = 100, height = 50, children, ratio = 1 } = props;
const ref = useRef<HTMLDivElement>(null);
const resizeRef = useRef<HTMLDivElement>(null);
@@ -42,7 +52,7 @@ export const ResizeDialog = (props: BaseResizeDialogProps) => {
item.classList.remove(styles.dialogResizeActive);
});
};
- const highLight = (e: Event) => {
+ const highLight = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
if (!ref.current || !resizeRef.current) return;
const classList = resizeRef.current.classList;
if (!ref.current.contains(e.target as HTMLElement)) {
@@ -58,7 +68,7 @@ export const ResizeDialog = (props: BaseResizeDialogProps) => {
cancelHighlight();
highLight(e);
};
- const mouseDown = (e: MouseEvent) => {
+ const mouseDown = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
window.addEventListener('mousemove', mouseMove);
window.addEventListener('mouseup', mouseUp);
window.addEventListener('click', handleClick);
@@ -68,7 +78,7 @@ export const ResizeDialog = (props: BaseResizeDialogProps) => {
pastMove = [e.pageX, e.pageY];
move = true;
};
- const resizeMouseDown = (e: MouseEvent) => {
+ const resizeMouseDown = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
e.stopPropagation();
const target = e.target as HTMLElement;
if (!target.className.includes(`${styles.resizeItem}`)) return;
@@ -180,9 +190,3 @@ export const ResizeDialog = (props: BaseResizeDialogProps) => {
</div>
);
};
-
-export class UniverResizeDialog implements ResizeDialogComponent {
- render(): JSXComponent<BaseResizeDialogProps> {
- return ResizeDialog;
- }
-}
diff --git a/packages/base-ui/src/Components/SearchTree/SearchTree.tsx b/packages/base-ui/src/Components/SearchTree/SearchTree.tsx
deleted file mode 100644
index b64047286b..0000000000
--- a/packages/base-ui/src/Components/SearchTree/SearchTree.tsx
+++ /dev/null
@@ -1,160 +0,0 @@
-import { Component, createRef } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseSearchTreeProps, SearchTreeComponent } from '../../Interfaces';
-import * as Icon from '../Icon';
-import styles from './index.module.less';
-
-interface Data {
- label: string;
- checked: boolean;
-}
-// interface IProps {}
-interface IState {
- searchValue: string;
- data: Data[];
- dataClone: Data[];
-}
-
-class SearchTree extends Component<BaseSearchTreeProps, IState> {
- input = createRef();
-
- constructor(props: BaseSearchTreeProps) {
- super();
- this.initialize(props);
- }
-
- initialize(props: BaseSearchTreeProps) {
- this.state = {
- searchValue: '',
- data: [
- { label: '空白', checked: true },
- { label: '空白1', checked: false },
- ],
- dataClone: [],
- };
- }
-
- setLocale() {
- const locale = this.context.locale;
-
- const more = locale.get('toolbar.more');
- }
-
- /**
- * input 事件
- * @param event
- */
- onInput(event: Event) {
- const searchValue = this.input.current.value;
- this.setState({
- searchValue,
- });
- this.search(searchValue);
- }
-
- /**
- * 搜索
- * @param val
- */
- search(val: string) {
- const data = this.state.data;
- const dataClone = data.filter((item) => item.label.includes(val));
- this.setState({
- dataClone,
- });
- }
-
- /**
- * 多选框点击
- * @param index
- */
- onClick(index: number) {
- const data = this.state.dataClone;
- data[index].checked = !data[index].checked;
- this.setState({
- dataClone: data,
- });
- }
-
- /**
- * 全选
- */
- clickAll() {
- const data = this.state.dataClone;
- data.forEach((item) => {
- item.checked = true;
- });
- this.setState({
- dataClone: data,
- });
- }
-
- /**
- * 清除
- */
- clickClean() {
- const data = this.state.dataClone;
- data.forEach((item) => {
- item.checked = false;
- });
- this.setState({
- dataClone: data,
- });
- }
-
- /**
- * 反选
- */
- clickInvert() {
- const data = this.state.dataClone;
- data.forEach((item) => {
- item.checked = !item.checked;
- });
- this.setState({
- dataClone: data,
- });
- }
-
- UNSAFE_componentWillMount() {
- this.setState({ dataClone: this.state.data });
- }
-
- render() {
- return (
- <div className={styles.searchTreeWarpper}>
- <div>
- <button onClick={this.clickAll.bind(this)}>全选</button>
- <button onClick={this.clickClean.bind(this)}>清除</button>
- <button onClick={this.clickInvert.bind(this)}>反选</button>
- </div>
- <div className={styles.searchTreeInput}>
- <input ref={this.input} onInput={this.onInput.bind(this)} type="text" placeholder="按照值进行筛选" />
- <Icon.Sheet.SearchIcon />
- </div>
- <div>
- {this.state.dataClone.map((item, index: number) => (
- <div key={index}>
- <input type="checkbox" checked={item.checked} onClick={this.onClick.bind(this, index)} />
- {item.label}
- </div>
- ))}
- </div>
- <button
- onClick={() => {
- console.log(this.state.dataClone);
- }}
- >
- 点击
- </button>
- </div>
- );
- }
-}
-
-export class UniverSearchTree implements SearchTreeComponent {
- render(): JSXComponent<BaseSearchTreeProps> {
- return SearchTree;
- }
-}
-
-export { SearchTree };
diff --git a/packages/base-ui/src/Components/SearchTree/index.module.less b/packages/base-ui/src/Components/SearchTree/index.module.less
deleted file mode 100644
index 199ed45d21..0000000000
--- a/packages/base-ui/src/Components/SearchTree/index.module.less
+++ /dev/null
@@ -1,16 +0,0 @@
-.search-tree-warpper {
- outline: 1px solid var(--border-color-base);
- background: var(--bg);
- padding: 5px;
-}
-
-.search-tree-input {
- display: flex;
- border: 1px solid;
- border-radius: 2px;
- input {
- width: 100%;
- outline: none;
- border: none;
- }
-}
diff --git a/packages/base-ui/src/Components/SearchTree/index.ts b/packages/base-ui/src/Components/SearchTree/index.ts
deleted file mode 100644
index 468e3a6654..0000000000
--- a/packages/base-ui/src/Components/SearchTree/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { SearchTree } from './SearchTree';
diff --git a/packages/base-ui/src/Components/SiderModal/SiderModal.tsx b/packages/base-ui/src/Components/SiderModal/SiderModal.tsx
index 9626fe9999..9e265286b1 100644
--- a/packages/base-ui/src/Components/SiderModal/SiderModal.tsx
+++ b/packages/base-ui/src/Components/SiderModal/SiderModal.tsx
@@ -1,65 +1,125 @@
-import { Component } from 'react';
-import { BaseSiderModalProps } from '../../Interfaces';
+import { RefObject, useContext, useEffect, useState } from 'react';
+
+import { AppContext } from '../../Common/AppContext';
import { Icon } from '../index';
-import Style from './index.module.less';
-
-type IState = {
- zIndex: number;
- show: boolean;
-};
-
-class SiderModal extends Component<BaseSiderModalProps, IState> {
- constructor(props: BaseSiderModalProps) {
- super();
- this.initialize(props);
- }
-
- initialize(props: BaseSiderModalProps) {
- this.state = {
- zIndex: props.zIndex ?? 0,
- show: props.show ?? true,
- };
- }
-
- close() {
- this.setState({
- show: false,
- });
- }
-
- handleClick() {
- const zIndex = this.context.zIndexManager.getMaxIndex() + 1;
- this.setState({
- zIndex,
- });
- }
-
- UNSAFE_componentWillReceiveProps(props: BaseSiderModalProps): void {
- this.setState({
- show: props.show ?? true,
- });
- }
-
- render() {
- const { className = '', style } = this.props;
- const { zIndex, show } = this.state;
- this.context.zIndexManager.setIndex(this.props.name, zIndex);
-
- return show ? (
- <div className={`${Style.siderModal} ${className}`} style={{ ...style, zIndex }} onClick={() => this.handleClick()}>
- <div className={Style.siderModalHeader}>
- <h3 className={Style.siderModalTitle}>{this.props.title}</h3>
- <span className={Style.siderModalClose} onClick={() => this.close()}>
- <Icon.Other.Close></Icon.Other.Close>
- </span>
- </div>
- <div className={Style.siderModalBody}>
- <div className={Style.siderModalBodyInner}>{this.props.children}</div>
- </div>
- <div className={Style.siderModalFooter}>{this.props.footer}</div>
- </div>
- ) : null;
- }
+
+// class SiderModal extends Component<BaseSiderModalProps, IState> {
+// static override contextType = AppContext;
+
+// constructor(props: BaseSiderModalProps) {
+// super();
+// this.initialize(props);
+// }
+
+// initialize(props: BaseSiderModalProps) {
+// this.state = {
+// zIndex: props.zIndex ?? 0,
+// show: props.show ?? true,
+// };
+// }
+
+// close() {
+// this.setState({
+// show: false,
+// });
+// }
+
+// handleClick() {
+// const zIndex = this.context.zIndexManager.getMaxIndex() + 1;
+// this.setState({
+// zIndex,
+// });
+// }
+
+// UNSAFE_componentWillReceiveProps(props: BaseSiderModalProps): void {
+// this.setState({
+// show: props.show ?? true,
+// });
+// }
+
+// render() {
+// const { className = '', style } = this.props;
+// const { zIndex, show } = this.state;
+// this.context.zIndexManager.setIndex(this.props.name, zIndex);
+
+// return show ? (
+// <div className={`${Style.siderModal} ${className}`} style={{ ...style, zIndex }} onClick={() => this.handleClick()}>
+// <div className={Style.siderModalHeader}>
+// <h3 className={Style.siderModalTitle}>{this.props.title}</h3>
+// <span className={Style.siderModalClose} onClick={() => this.close()}>
+// <Icon.Other.Close></Icon.Other.Close>
+// </span>
+// </div>
+// <div className={Style.siderModalBody}>
+// <div className={Style.siderModalBodyInner}>{this.props.children}</div>
+// </div>
+// <div className={Style.siderModalFooter}>{this.props.footer}</div>
+// </div>
+// ) : null;
+// }
+// }
+
+// export { SiderModal };
+
+export interface BaseSiderModalProps {
+ name: string;
+ title: string | any;
+ show?: boolean;
+ children?: React.ReactNode;
+ footer?: React.ReactNode;
+ ref?: RefObject<HTMLElement>;
+ className?: string;
+ zIndex?: number;
+ style?: React.CSSProperties;
}
-export { SiderModal };
+export function SiderModal(props: BaseSiderModalProps) {
+ const context = useContext(AppContext);
+ const { className = '', style } = props;
+ const [zIndex, setZIndex] = useState<number>(props.zIndex ?? 0);
+ const [show, setShow] = useState<boolean>(props.show ?? true);
+
+ useEffect(() => {
+ // Assuming you have a function getMaxIndex() and setIndex() in your context
+ const contextZIndexManager = context.zIndexManager;
+ if (contextZIndexManager) {
+ const newZIndex = contextZIndexManager.getMaxIndex() + 1;
+ setZIndex(newZIndex);
+ contextZIndexManager.setIndex(props.name, newZIndex);
+ }
+ }, [props.name]);
+
+ useEffect(() => {
+ if (props.show !== show) {
+ setShow(props.show ?? true);
+ }
+ }, [props.show]);
+
+ const close = () => {
+ setShow(false);
+ };
+
+ const handleClick = () => {
+ const contextZIndexManager = context.zIndexManager;
+ if (contextZIndexManager) {
+ const newZIndex = contextZIndexManager.getMaxIndex() + 1;
+ setZIndex(newZIndex);
+ contextZIndexManager.setIndex(props.name, newZIndex);
+ }
+ };
+
+ return show ? (
+ <div className={`siderModal ${className}`} style={{ ...style, zIndex }} onClick={handleClick}>
+ <div className="siderModalHeader">
+ <h3 className="siderModalTitle">{props.title}</h3>
+ <span className="siderModalClose" onClick={close}>
+ <Icon.Other.Close></Icon.Other.Close>
+ </span>
+ </div>
+ <div className="siderModalBody">
+ <div className="siderModalBodyInner">{props.children}</div>
+ </div>
+ <div className="siderModalFooter">{props.footer}</div>
+ </div>
+ ) : null;
+}
diff --git a/packages/base-ui/src/Components/Slider/Slider.tsx b/packages/base-ui/src/Components/Slider/Slider.tsx
index b8b15409c8..8d91e4b40f 100644
--- a/packages/base-ui/src/Components/Slider/Slider.tsx
+++ b/packages/base-ui/src/Components/Slider/Slider.tsx
@@ -1,158 +1,254 @@
-import { Component, createRef } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseSliderRangeProps, BaseSliderSingleProps, SliderComponent } from '../../Interfaces';
+// export class Slider extends Component<BaseSliderRangeProps | BaseSliderSingleProps, SliderState> {
+// idPrev: string;
+// idNext: string;
+// width: number;
+// ref = createRef();
+// constructor(props: BaseSliderSingleProps | BaseSliderRangeProps) {
+// super();
+// this.initialize(props);
+// }
+// initialize(props: BaseSliderSingleProps | BaseSliderRangeProps) {
+// this.state = {
+// valuePrev: 0,
+// valueNext: 0,
+// };
+// }
+// onInput = (index: number, e: Event) => {
+// const target = e.target as HTMLInputElement;
+// const value = target.value;
+// this.changeInputValue(index, value);
+// this.props.onChange?.call(this, e);
+// };
+// /**
+// * 返回改变后的值
+// */
+// onClick = (index: number, e: MouseEvent) => {
+// const { min = 0, max = 100, step = 1 } = this.props;
+// const target = e.currentTarget as HTMLElement;
+// const track = e.offsetX;
+// const width = target.offsetWidth;
+// if (track < 0 || track > width) return;
+// let value = (track / this.width) * (max - min);
+// if (value % step) {
+// value += step - (value % step);
+// }
+// this.changeInputValue(index, value);
+// this.props.onClick?.call(this, e, value);
+// };
+// /**
+// *
+// * @param index 改变值的input index
+// * @param value 改变的值
+// * 控制input样式
+// */
+// changeInputValue = (index: number, value: number | string) => {
+// const parentNode = this.ref.current;
+// const input = parentNode.getElementsByTagName('input')[index];
+// const id = input.id;
+// parentNode.style.setProperty(`--${id}`, value);
+// if (!index) {
+// this.setValue({ valuePrev: value });
+// } else {
+// this.setValue({ valueNext: value });
+// }
+// };
+// setValue = (value: object, fn?: () => void) => {
+// this.setState(
+// (prevState) => ({
+// ...value,
+// }),
+// fn
+// );
+// };
+// UNSAFE_componentWillMount() {
+// // 生成随机id
+// this.idPrev = randomId('slider');
+// this.idNext = randomId('slider');
+// }
+// componentDidMount() {
+// const { min = 0, max = 100, range } = this.props;
+// const diff = max - min;
+// const slider = this.ref.current;
+// this.width = slider.offsetWidth;
+// slider.style.cssText += `--${this.idPrev}: ${this.state.valuePrev}; --${this.idNext}: ${this.state.valueNext}`;
+// document.styleSheets[0].addRule(
+// `.${styles.slider}::after`,
+// `margin-left: calc((var(--${this.idNext}) - ${min})/${diff}*100%); width: calc((var(--${this.idPrev}) - var(--${this.idNext}))/${diff}*100%);`
+// );
+// document.styleSheets[0].insertRule(
+// `.${styles.slider}::after {margin-left: calc((var(--${this.idNext}) - ${min})/${diff}*100%); width: calc((var(--${this.idPrev}) - var(--${this.idNext}))/${diff}*100%);}`,
+// 0
+// );
+// document.styleSheets[0].addRule(
+// `.${styles.slider}::before`,
+// `margin-left: calc((var(--${this.idPrev}) - ${min})/${diff}*100%);width: calc((var(--${this.idNext}) - var(--${this.idPrev}))/${diff}*100%);`
+// );
+// document.styleSheets[0].insertRule(
+// `.${styles.slider}::before {margin-left: calc((var(--${this.idPrev}) - ${min})/${diff}*100%);width: calc((var(--${this.idNext}) - var(--${this.idPrev}))/${diff}*100%);}`,
+// 0
+// );
+// // 初始化input值和样式
+// if (range) {
+// let { value } = this.props as BaseSliderRangeProps;
+// value = value || [0, 0];
+// this.setValue({
+// valuePrev: value![0],
+// valueNext: value![1],
+// });
+// } else {
+// let { value } = this.props as BaseSliderSingleProps;
+// value = value || 0;
+// this.changeInputValue(0, value);
+// }
+// }
+// render() {
+// const { valuePrev, valueNext } = this.state;
+// const { step = 1, min = 0, max = 100, range = false } = this.props;
+// if (range) {
+// return (
+// <div className={styles.slider} role="group" aria-labelledby="multi-lbl" style={{ '--min': min, '--max': max }} ref={this.ref}>
+// <label className="sr-only" htmlFor={this.idPrev}></label>
+// <input id={this.idPrev} type="range" min={min} value={valuePrev} max={max} step={step} onInput={(e) => this.onInput(0, e)} />
+// <label className="sr-only" htmlFor={this.idNext}></label>
+// <input id={this.idNext} type="range" min={min} value={valueNext} max={max} step={step} onInput={(e) => this.onInput(1, e)} />
+// </div>
+// );
+// }
+// return (
+// <div className={styles.slider} role="group" aria-labelledby="multi-lbl" style={{ '--min': min, '--max': max }} ref={this.ref} onClick={(e) => this.onClick(0, e)}>
+// <label className="sr-only" htmlFor={this.idPrev}></label>
+// <input id={this.idPrev} type="range" min={min} value={valuePrev} max={max} step={step} onInput={(e) => this.onInput(0, e)} />
+// </div>
+// );
+// }
+// }
+import React, { CSSProperties, ForwardedRef, forwardRef, useEffect, useRef, useState } from 'react';
+
import { randomId } from '../../Utils';
import styles from './index.module.less';
-interface SliderState {
- valuePrev: number;
- valueNext: number;
+interface SliderBaseProps {
+ min?: number;
+ max?: number;
+ step?: number;
+ className?: string;
+ style?: React.CSSProperties;
}
-export class Slider extends Component<BaseSliderRangeProps | BaseSliderSingleProps, SliderState> {
- idPrev: string;
+export interface BaseSliderSingleProps extends SliderBaseProps {
+ range?: false;
+ value?: number;
+ onChange?: (e: Event) => void;
+ onClick?: (e: Event, value: number | string) => void;
+}
- idNext: string;
+export interface BaseSliderRangeProps extends SliderBaseProps {
+ range: true;
+ value?: [number, number];
+ onChange?: (e: Event) => void;
+ onClick?: (e: Event, value: number | string) => void;
+}
- width: number;
+function SliderFactory(props: BaseSliderRangeProps | BaseSliderSingleProps, ref: ForwardedRef<HTMLDivElement>) {
+ const [valuePrev, setValuePrev] = useState<number>(0);
+ const [valueNext, setValueNext] = useState<number>(0);
+ const idPrevRef = useRef<string>(randomId('slider'));
+ const idNextRef = useRef<string>(randomId('slider'));
+ const sliderRef = useRef<HTMLDivElement | null>(null);
- ref = createRef();
+ const { min = 0, max = 100, step = 1, range = false } = props;
- constructor(props: BaseSliderSingleProps | BaseSliderRangeProps) {
- super();
- this.initialize(props);
- }
+ useEffect(() => {
+ // 初始化input值和样式
+ if (range) {
+ let { value } = props as BaseSliderRangeProps;
+ value = value || [0, 0];
+ setValuePrev(value[0]);
+ setValueNext(value[1]);
+ } else {
+ let { value } = props as BaseSliderSingleProps;
+ value = value || 0;
+ changeInputValue(0, value);
+ }
- initialize(props: BaseSliderSingleProps | BaseSliderRangeProps) {
- this.state = {
- valuePrev: 0,
- valueNext: 0,
- };
- }
+ const diff = max - min;
+ const slider = sliderRef.current;
+
+ if (slider) {
+ const width = slider.offsetWidth;
+ slider.style.cssText += `--${idPrevRef.current}: ${valuePrev}; --${idNextRef.current}: ${valueNext}`;
+ const styleSheet = document.styleSheets[0];
+ if (styleSheet) {
+ // document.styleSheets[0].addRule(
+ // `.${styles.slider}::after`,
+ // `margin-left: calc((var(--${idNextRef.current}) - ${min})/${diff}*100%); width: calc((var(--${idPrevRef.current}) - var(--${idNextRef.current}))/${diff}*100%);`
+ // );
+
+ styleSheet.insertRule(
+ `.${styles.slider}::after {margin-left: calc((var(--${idNextRef.current}) - ${min})/${diff}*100%); width: calc((var(--${idPrevRef.current}) - var(--${idNextRef.current}))/${diff}*100%);}`,
+ 0
+ );
+
+ // document.styleSheets[0].addRule(
+ // `.${styles.slider}::before`,
+ // `margin-left: calc((var(--${idPrevRef.current}) - ${min})/${diff}*100%);width: calc((var(--${idNextRef.current}) - var(--${idPrevRef.current}))/${diff}*100%);`
+ // );
+
+ styleSheet.insertRule(
+ `.${styles.slider}::before {margin-left: calc((var(--${idPrevRef.current}) - ${min})/${diff}*100%);width: calc((var(--${idNextRef.current}) - var(--${idPrevRef.current}))/${diff}*100%);}`,
+ 0
+ );
+ }
+ }
+ }, [min, max, range, valuePrev, valueNext]);
- onInput = (index: number, e: Event) => {
- const target = e.target as HTMLInputElement;
- const value = target.value;
- this.changeInputValue(index, value);
- this.props.onChange?.call(this, e);
+ const onInput = (index: number, e: React.FormEvent<HTMLInputElement>) => {
+ const value = Number((e.target as HTMLInputElement).value);
+ changeInputValue(index, value);
+ props.onChange?.(e.nativeEvent);
};
- /**
- * 返回改变后的值
- */
- onClick = (index: number, e: MouseEvent) => {
- const { min = 0, max = 100, step = 1 } = this.props;
- const target = e.currentTarget as HTMLElement;
- const track = e.offsetX;
+ const onClick = (index: number, e: React.MouseEvent<HTMLDivElement>) => {
+ const { min = 0, max = 100, step = 1 } = props;
+ const target = e.currentTarget;
+ const track = e.nativeEvent.offsetX;
const width = target.offsetWidth;
if (track < 0 || track > width) return;
- let value = (track / this.width) * (max - min);
+ let value = (track / width) * (max - min);
if (value % step) {
value += step - (value % step);
}
- this.changeInputValue(index, value);
- this.props.onClick?.call(this, e, value);
+ changeInputValue(index, value);
+ props.onClick?.(e.nativeEvent, value);
};
- /**
- *
- * @param index 改变值的input index
- * @param value 改变的值
- * 控制input样式
- */
- changeInputValue = (index: number, value: number | string) => {
- const parentNode = this.ref.current;
+ const changeInputValue = (index: number, value: number) => {
+ const parentNode = sliderRef.current;
+ if (!parentNode) return;
const input = parentNode.getElementsByTagName('input')[index];
const id = input.id;
- parentNode.style.setProperty(`--${id}`, value);
+ parentNode.style.setProperty(`--${id}`, String(value));
if (!index) {
- this.setValue({ valuePrev: value });
+ setValuePrev(value);
} else {
- this.setValue({ valueNext: value });
+ setValueNext(value);
}
};
- setValue = (value: object, fn?: () => void) => {
- this.setState(
- (prevState) => ({
- ...value,
- }),
- fn
- );
- };
-
- UNSAFE_componentWillMount() {
- // 生成随机id
- this.idPrev = randomId('slider');
- this.idNext = randomId('slider');
- }
-
- componentDidMount() {
- const { min = 0, max = 100, range } = this.props;
- const diff = max - min;
-
- const slider = this.ref.current;
- this.width = slider.offsetWidth;
- slider.style.cssText += `--${this.idPrev}: ${this.state.valuePrev}; --${this.idNext}: ${this.state.valueNext}`;
-
- document.styleSheets[0].addRule(
- `.${styles.slider}::after`,
- `margin-left: calc((var(--${this.idNext}) - ${min})/${diff}*100%); width: calc((var(--${this.idPrev}) - var(--${this.idNext}))/${diff}*100%);`
- );
- document.styleSheets[0].insertRule(
- `.${styles.slider}::after {margin-left: calc((var(--${this.idNext}) - ${min})/${diff}*100%); width: calc((var(--${this.idPrev}) - var(--${this.idNext}))/${diff}*100%);}`,
- 0
- );
-
- document.styleSheets[0].addRule(
- `.${styles.slider}::before`,
- `margin-left: calc((var(--${this.idPrev}) - ${min})/${diff}*100%);width: calc((var(--${this.idNext}) - var(--${this.idPrev}))/${diff}*100%);`
- );
- document.styleSheets[0].insertRule(
- `.${styles.slider}::before {margin-left: calc((var(--${this.idPrev}) - ${min})/${diff}*100%);width: calc((var(--${this.idNext}) - var(--${this.idPrev}))/${diff}*100%);}`,
- 0
- );
-
- // 初始化input值和样式
- if (range) {
- let { value } = this.props as BaseSliderRangeProps;
- value = value || [0, 0];
- this.setValue({
- valuePrev: value![0],
- valueNext: value![1],
- });
- } else {
- let { value } = this.props as BaseSliderSingleProps;
- value = value || 0;
- this.changeInputValue(0, value);
- }
- }
-
- render() {
- const { valuePrev, valueNext } = this.state;
- const { step = 1, min = 0, max = 100, range = false } = this.props;
- if (range) {
- return (
- <div className={styles.slider} role="group" aria-labelledby="multi-lbl" style={{ '--min': min, '--max': max }} ref={this.ref}>
- <label className="sr-only" htmlFor={this.idPrev}></label>
- <input id={this.idPrev} type="range" min={min} value={valuePrev} max={max} step={step} onInput={(e) => this.onInput(0, e)} />
- <label className="sr-only" htmlFor={this.idNext}></label>
- <input id={this.idNext} type="range" min={min} value={valueNext} max={max} step={step} onInput={(e) => this.onInput(1, e)} />
- </div>
- );
- }
- return (
- <div className={styles.slider} role="group" aria-labelledby="multi-lbl" style={{ '--min': min, '--max': max }} ref={this.ref} onClick={(e) => this.onClick(0, e)}>
- <label className="sr-only" htmlFor={this.idPrev}></label>
- <input id={this.idPrev} type="range" min={min} value={valuePrev} max={max} step={step} onInput={(e) => this.onInput(0, e)} />
- </div>
- );
- }
+ return (
+ <div className={styles.slider} role="group" aria-labelledby="multi-lbl" style={{ '--min': min, '--max': max } as CSSProperties} ref={sliderRef}>
+ <label className="sr-only" htmlFor={idPrevRef.current}></label>
+ <input id={idPrevRef.current} type="range" min={min} value={valuePrev} max={max} step={step} onInput={(e) => onInput(0, e)} />
+ {range && (
+ <>
+ <label className="sr-only" htmlFor={idNextRef.current}></label>
+ <input id={idNextRef.current} type="range" min={min} value={valueNext} max={max} step={step} onInput={(e) => onInput(1, e)} />
+ </>
+ )}
+ </div>
+ );
}
-export class UniverSlider implements SliderComponent {
- render(): JSXComponent<BaseSliderRangeProps | BaseSliderSingleProps> {
- return Slider;
- }
-}
+// Use React.forwardRef to wrap the component
+export const Slider = forwardRef(SliderFactory);
diff --git a/packages/base-ui/src/Components/Slider/slider.md b/packages/base-ui/src/Components/Slider/slider.md
index 19de8fbe55..179ba90695 100644
--- a/packages/base-ui/src/Components/Slider/slider.md
+++ b/packages/base-ui/src/Components/Slider/slider.md
@@ -21,7 +21,7 @@ Property Introduction:
| min | The maximum value the slider can slide to | number | 0 |
| max | The minimum value the slider can slide to | number | 100 |
| step | The granularity the slider can step through values. Must greater than 0, and be divided by (max - min) | number | 1 |
-| className | classname | string | - |
+| className | className | string | - |
| style | css style | cssStyle | - |
| value | The value of slider | number | - |
| onChange | Callback function that is fired when the user changes the slider's value | (e: Event) => void | - |
diff --git a/packages/base-ui/src/Components/Slider/test/index.test.tsx b/packages/base-ui/src/Components/Slider/test/index.test.tsx
index 3aa427ae3c..a12e40fab5 100644
--- a/packages/base-ui/src/Components/Slider/test/index.test.tsx
+++ b/packages/base-ui/src/Components/Slider/test/index.test.tsx
@@ -4,16 +4,8 @@ import { Slider } from '..';
describe('input', () => {
test('input', () => {
- // const dom = document.styleSheets[0];
- // console.dir(dom);
const { container } = render(<Slider value={2} min={10} max={200} step={1} className="slider" style={{ color: 'red' }} />);
expect(container);
});
- // test('input event', () => {
- // let a = 1;
- // const { container } = render(<Input value="test" readonly onClick={() => a++} disabled placeholder="haha" className="test" />);
- // fireEvent.click(document.querySelector('.test')!);
- // expect(a).toEqual(2);
- // });
});
diff --git a/packages/base-ui/src/Components/Slot/Slot.tsx b/packages/base-ui/src/Components/Slot/Slot.tsx
index 19ba2c0bf9..e0355a8187 100644
--- a/packages/base-ui/src/Components/Slot/Slot.tsx
+++ b/packages/base-ui/src/Components/Slot/Slot.tsx
@@ -1,88 +1,118 @@
-import { Component } from 'react';
+// export class Slot extends Component<IProps, IState> {
+// static override contextType = AppContext;
+// private _refs: any[] = [];
+// constructor(props: IProps) {
+// super(props);
+// this.initialize();
+// }
+// initialize() {
+// this.state = {
+// slotGroup: new Map(),
+// };
+// }
+// override componentDidMount(): void {
+// this.props.getComponent?.(this);
+// }
+// setSlot(component: SlotComponent, cb?: () => void) {
+// const { slotGroup } = this.state;
+// slotGroup.set(component.name, component);
+// this.setState(
+// {
+// slotGroup,
+// },
+// () => {
+// cb?.();
+// }
+// );
+// }
+// setSlotAll(slots: Map<string, SlotComponent>) {
+// const { slotGroup } = this.state;
+// slots.forEach((item) => {
+// slotGroup.set(item.name, item);
+// });
+// this.setState({
+// slotGroup,
+// });
+// }
+// removeSlot(component: SlotComponent) {
+// const { slotGroup } = this.state;
+// const slot = slotGroup.get(component.name);
+// if (!slot) return;
+// slotGroup.delete(component.name);
+// this.setState({
+// slotGroup,
+// });
+// }
+// getSlots() {
+// return this._refs;
+// }
+// renderSlot() {
+// const { slotGroup } = this.state;
+// const arr: JSX.Element[] = [];
+// slotGroup.forEach((item, index) => {
+// const Label = this.context.componentManager.get(item.component.name);
+// if (Label) {
+// arr.push(<Label key={index} ref={(ref: any) => (this._refs[index as any] = ref)} {...item.component.props} />);
+// }
+// });
+// return arr;
+// }
+// render() {
+// return <>{this.renderSlot()}</>;
+// }
+// }
+import React, { useContext, useRef, useState } from 'react';
+
import { BaseComponentProps } from '../../BaseComponent';
+import { AppContext } from '../../Common/AppContext';
import { SlotComponent } from '../../Common/SlotManager';
-import { AppContext } from '../../Common';
-
-interface IState {
- slotGroup: Map<string, SlotComponent>;
-}
interface IProps extends BaseComponentProps {
name: string;
}
+export function Slot(props: IProps) {
+ const context = useContext(AppContext);
+ const [slotGroup, setSlotGroup] = useState(new Map<string, SlotComponent>());
+ const _refs = useRef<any[]>([]);
-export class Slot extends Component<IProps, IState> {
- static override contextType = AppContext;
-
- private _refs: any[] = [];
-
- constructor(props: IProps) {
- super(props);
- this.initialize();
- }
-
- initialize() {
- this.state = {
- slotGroup: new Map(),
- };
- }
-
- override componentDidMount(): void {
- this.props.getComponent?.(this);
- }
+ // useEffect(() => {
+ // props.getComponent?.(this);
+ // }, []);
- setSlot(component: SlotComponent, cb?: () => void) {
- const { slotGroup } = this.state;
- slotGroup.set(component.name, component);
+ const setSlot = (component: SlotComponent, cb?: () => void) => {
+ const newSlotGroup = new Map(slotGroup);
+ newSlotGroup.set(component.name, component);
+ setSlotGroup(newSlotGroup);
+ cb?.();
+ };
- this.setState(
- {
- slotGroup,
- },
- () => {
- cb?.();
- }
- );
- }
-
- setSlotAll(slots: Map<string, SlotComponent>) {
- const { slotGroup } = this.state;
+ const setSlotAll = (slots: Map<string, SlotComponent>) => {
+ const newSlotGroup = new Map(slotGroup);
slots.forEach((item) => {
- slotGroup.set(item.name, item);
- });
-
- this.setState({
- slotGroup,
+ newSlotGroup.set(item.name, item);
});
- }
+ setSlotGroup(newSlotGroup);
+ };
- removeSlot(component: SlotComponent) {
- const { slotGroup } = this.state;
- const slot = slotGroup.get(component.name);
+ const removeSlot = (component: SlotComponent) => {
+ const newSlotGroup = new Map(slotGroup);
+ const slot = newSlotGroup.get(component.name);
if (!slot) return;
- slotGroup.delete(component.name);
- this.setState({
- slotGroup,
- });
- }
+ newSlotGroup.delete(component.name);
+ setSlotGroup(newSlotGroup);
+ };
- getSlots() {
- return this._refs;
- }
+ const getSlots = () => _refs.current;
- renderSlot() {
- const { slotGroup } = this.state;
+ const renderSlot = () => {
const arr: JSX.Element[] = [];
slotGroup.forEach((item, index) => {
- const Label = this.context.componentManager.get(item.component.name);
+ const Label = context?.componentManager?.get(item.component.name) as React.ComponentType<any>;
if (Label) {
- arr.push(<Label key={index} ref={(ref: any) => (this._refs[index as any] = ref)} {...item.component.props} />);
+ arr.push(<Label key={index} ref={(ref: any) => (_refs.current[index as any] = ref)} {...item.component.props} />);
}
});
return arr;
- }
-
- render() {
- return <>{this.renderSlot()}</>;
- }
+ };
+ return <>{renderSlot()}</>;
}
diff --git a/packages/base-ui/src/Components/Tabs/Tabs.tsx b/packages/base-ui/src/Components/Tabs/Tabs.tsx
index b1431affdf..c016cd1624 100644
--- a/packages/base-ui/src/Components/Tabs/Tabs.tsx
+++ b/packages/base-ui/src/Components/Tabs/Tabs.tsx
@@ -1,15 +1,81 @@
-import { JSX, toChildArray, PureComponent } from 'react';
-import { JSXComponent } from '../../BaseComponent';
-import { BaseTabProps, BaseTabPaneProps, TabComponent, TabPaneComponent } from '../../Interfaces';
-import { randomId, joinClassNames } from '../../Utils';
-import styles from './index.module.less';
+// export class Tab extends PureComponent<BaseTabProps> {
+// state = {
+// active: '',
+// };
+// setValue = (value: object, fn?: () => void) => {
+// this.setState(
+// (prevState) => ({
+// ...value,
+// }),
+// fn
+// );
+// };
+// UNSAFE_componentWillMount() {
+// this.setValue({ active: this.props.activeKey, children: this.props.children });
+// }
+// // generate tab navlist
+// parseNavList = () => {
+// const { active } = this.state;
+// return toChildArray(this.props.children).map((node) => {
+// const { tab, keys } = (node as JSX.Element).props;
+// const id = `${randomId('tab')}-${keys}`;
+// if (active === keys) {
+// return (
+// <div key={id} id={id} onClick={this.handleClick} className={joinClassNames(styles.tabsTab, styles.tabsTabActive)}>
+// {tab}
+// </div>
+// );
+// }
+// return (
+// <div key={id} id={id} onClick={this.handleClick} className={styles.tabsTab}>
+// {tab}
+// </div>
+// );
+// });
+// };
+// handleClick = (e: Event) => {
+// const id = (e.target as HTMLElement).id;
+// const index = id.lastIndexOf('-');
+// const value = id.slice(index + 1);
+// this.setValue({ active: value });
+// this.props.onTabClick?.(value, e);
+// };
+// render() {
+// const { children, type = 'line', className = '' } = this.props;
+// const classes = joinClassNames(
+// styles.tabs,
+// {
+// [`${styles.tabs}-card`]: type === 'card',
+// },
+// className
+// );
+// // if (type == 'line') {
+// // return <div></div>;
+// // }
+// return (
+// <div className={classes}>
+// <div className={styles.tabsNav}>
+// <div className={styles.tabsNavWrap}>
+// <div className={styles.tabsNavList}>{this.parseNavList()}</div>
+// </div>
+// </div>
+// <div className={styles.tabsContent}>
+// {children.map((item: JSX.Element, index: number) => (
+// <TabPane key={index} keys={item.props.keys} active={item.props.keys === this.state.active}>
+// {item.props.children}
+// </TabPane>
+// ))}
+// </div>
+// </div>
+// );
+// }
+// }
// interface IProps {
// className?: string;
// style?: JSX.CSSProperties;
// children?: any;
// }
-
// interface TabBaseProps extends IProps {
// // type?: 'line' | 'card';
// type?: 'card';
@@ -21,7 +87,6 @@ import styles from './index.module.less';
// // onChange?: (activeKey: string) => void;
// onTabClick?: (activeKey: string, e: Event) => void;
// }
-
// interface TabPaneProps {
// active?: boolean;
// tab?: JSX.Element | string;
@@ -31,109 +96,96 @@ import styles from './index.module.less';
// style?: JSX.CSSProperties;
// children?: ComponentChildren;
// }
+import React, { useEffect, useState } from 'react';
-type BaseTabState = {
- active: string;
-};
+import { BaseComponentProps } from '../../BaseComponent';
+import { joinClassNames, randomId } from '../../Utils';
+import styles from './index.module.less';
-export class Tab extends PureComponent<BaseTabProps> {
- state = {
- active: '',
- };
+interface IProps {
+ className?: string;
+ style?: React.CSSProperties;
+ children?: any;
+}
- setValue = (value: object, fn?: () => void) => {
- this.setState(
- (prevState) => ({
- ...value,
- }),
- fn
- );
- };
+export interface BaseTabPaneProps {
+ active?: boolean;
+ tab?: JSX.Element | string;
+ keys?: string;
+ id?: string;
+ className?: string;
+ style?: React.CSSProperties;
+ children?: any;
+}
+
+export interface BaseTabProps extends IProps, BaseComponentProps {
+ type?: 'card';
+ activeKey?: string;
+ onTabClick?: (activeKey: string, e: Event) => void;
+}
+
+export function Tab(props: BaseTabProps) {
+ const { children, type = 'line', className = '' } = props;
+ const [active, setActive] = useState<string>(props.activeKey || ''); // Initialize active with the provided activeKey
+ const [tabChildren, setTabChildren] = useState<any>(props.children);
- UNSAFE_componentWillMount() {
- this.setValue({ active: this.props.activeKey, children: this.props.children });
- }
+ useEffect(() => {
+ props.activeKey && setActive(props.activeKey); // Update active state when props.activeKey changes
+ }, [props.activeKey]);
- // generate tab navlist
- parseNavList = () => {
- const { active } = this.state;
- return toChildArray(this.props.children).map((node) => {
- const { tab, keys } = (node as JSX.Element).props;
+ useEffect(() => {
+ setTabChildren(props.children); // Update children state when props.children changes
+ }, [props.children]);
+
+ const parseNavList = () =>
+ React.Children.map(tabChildren, (child) => {
+ const { tab, keys } = (child as React.ReactElement).props;
const id = `${randomId('tab')}-${keys}`;
- if (active === keys) {
- return (
- <div key={id} id={id} onClick={this.handleClick} className={joinClassNames(styles.tabsTab, styles.tabsTabActive)}>
- {tab}
- </div>
- );
- }
+ const tabClassName = active === keys ? `${styles.tabsTab} ${styles.tabsTabActive}` : styles.tabsTab;
+
return (
- <div key={id} id={id} onClick={this.handleClick} className={styles.tabsTab}>
+ <div key={id} id={id} onClick={handleClick} className={tabClassName}>
{tab}
</div>
);
});
- };
- handleClick = (e: Event) => {
- const id = (e.target as HTMLElement).id;
+ const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
+ const id = e.currentTarget.id;
const index = id.lastIndexOf('-');
const value = id.slice(index + 1);
- this.setValue({ active: value });
+ setActive(value);
- this.props.onTabClick?.(value, e);
+ if (props.onTabClick) {
+ props.onTabClick(value, e.nativeEvent);
+ }
};
- render() {
- const { children, type = 'line', className = '' } = this.props;
- const classes = joinClassNames(
- styles.tabs,
- {
- [`${styles.tabs}-card`]: type === 'card',
- },
- className
- );
- // if (type == 'line') {
- // return <div></div>;
- // }
- return (
- <div className={classes}>
- <div className={styles.tabsNav}>
- <div className={styles.tabsNavWrap}>
- <div className={styles.tabsNavList}>{this.parseNavList()}</div>
- </div>
- </div>
- <div className={styles.tabsContent}>
- {children.map((item: JSX.Element, index: number) => (
- <TabPane key={index} keys={item.props.keys} active={item.props.keys === this.state.active}>
- {item.props.children}
- </TabPane>
- ))}
+ return (
+ <div className={`${styles.tabs} ${type === 'card' ? `${styles.tabs}-card` : ''} ${className}`}>
+ <div className={styles.tabsNav}>
+ <div className={styles.tabsNavWrap}>
+ <div className={styles.tabsNavList}>{parseNavList()}</div>
</div>
</div>
- );
- }
+ <div className={styles.tabsContent}>
+ {React.Children.map(tabChildren, (child, index) => (
+ <TabPane key={index} keys={(child as React.ReactElement).props.keys} active={(child as React.ReactElement).props.keys === active}>
+ {(child as React.ReactElement).props.children}
+ </TabPane>
+ ))}
+ </div>
+ </div>
+ );
}
// tab content
-export const TabPane = (props: BaseTabPaneProps) => {
+export function TabPane(props: BaseTabPaneProps) {
const { id, keys, style, children, active } = props;
return (
<div id={id && `${id}-panel-${keys}`} role="tabpanel" style={{ ...style }} className={joinClassNames(styles.tabsPanel, active && styles.tabsPanelActive)}>
{active && children}
</div>
);
-};
-
-export class UniverTab implements TabComponent {
- render(): JSXComponent<BaseTabProps> {
- return Tab;
- }
-}
-
-export class UniverTabPane implements TabPaneComponent {
- render(): JSXComponent<BaseTabProps> {
- return TabPane;
- }
}
diff --git a/packages/base-ui/src/Components/Tooltip/Tooltip.tsx b/packages/base-ui/src/Components/Tooltip/Tooltip.tsx
index 43829f2031..a76bcfafd3 100644
--- a/packages/base-ui/src/Components/Tooltip/Tooltip.tsx
+++ b/packages/base-ui/src/Components/Tooltip/Tooltip.tsx
@@ -1,8 +1,8 @@
import { createRef, useState } from 'react';
-import { BaseTooltipProps } from '../../Interfaces';
+
+import { BaseComponentProps } from '../../BaseComponent';
import { joinClassNames } from '../../Utils';
import { CustomLabel } from '../CustomLabel';
-
import style from './index.module.less';
// interface TooltipProps {
@@ -29,6 +29,17 @@ const placementClassNames: { [index: string]: string } = {
right: style.right,
};
+export interface BaseTooltipProps extends BaseComponentProps {
+ [index: number]: string;
+
+ title?: string;
+ shortcut?: string;
+ children: React.ReactNode;
+ placement?: string;
+ color?: string;
+ styles?: {};
+}
+
export function Tooltip(props: BaseTooltipProps) {
const tooltip = createRef<HTMLDivElement>();
const [state, setState] = useState<TooltipState>({
diff --git a/packages/base-ui/src/Components/index.ts b/packages/base-ui/src/Components/index.ts
index 8744cffba5..53f4178e2a 100644
--- a/packages/base-ui/src/Components/index.ts
+++ b/packages/base-ui/src/Components/index.ts
@@ -7,6 +7,7 @@ import { ColorPicker } from './ColorPicker';
import { ColorPickerCircleButton } from './ColorPickerCircleButton';
import { Container } from './Container';
import { CustomLabel } from './CustomLabel';
+import { Dropdown } from './Dropdown';
// import { FormatModal } from './FormatModal';
import * as Icon from './Icon/index';
import { Input } from './Input';
@@ -15,7 +16,6 @@ import { Menu } from './Menu';
import { Modal } from './Modal';
import { Radio, RadioGroup } from './Radio';
import { ResizeDialog } from './ResizeDialog';
-import { Dropdown } from './Dropdown';
import { Separator } from './Separator';
import { SiderModal } from './SiderModal';
import { Slider } from './Slider';
@@ -25,45 +25,43 @@ import { Tab, TabPane } from './Tabs';
import { Tooltip } from './Tooltip';
// import { Ul } from './Ul';
+export * from './CellRange';
+export * from './Item/Item';
export * from './Prompt';
-
export * from './Select';
-
-export * from './CellRange';
-
export * from './Slot/Slot';
export {
Avatar,
+ BorderLine,
Button,
+ // FormatModal,
+ Checkbox,
+ CheckboxGroup,
Collapse,
- Panel,
- Menu,
+ ColorPicker,
+ ColorPickerCircleButton,
Container,
- Layout,
- Header,
- Footer,
Content,
CustomLabel,
- Sider,
- Tooltip,
+ Dropdown,
+ Footer,
+ Header,
Icon,
Input,
- Separator,
- ColorPicker,
+ Layout,
+ Menu,
// Ul,
Modal,
- Slider,
+ Panel,
Radio,
RadioGroup,
- // FormatModal,
- Checkbox,
- CheckboxGroup,
+ ResizeDialog,
+ Separator,
+ Sider,
+ SiderModal,
+ Slider,
Tab,
TabPane,
- ColorPickerCircleButton,
- BorderLine,
- SiderModal,
- ResizeDialog,
- Dropdown,
+ Tooltip,
};
diff --git a/packages/base-ui/src/Interfaces/Avatar.ts b/packages/base-ui/src/Interfaces/Avatar.ts
deleted file mode 100644
index 4d44ff805b..0000000000
--- a/packages/base-ui/src/Interfaces/Avatar.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
-
-type Shape = 'circle' | 'square';
-// type BreakPoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
-// type AvatatScreen = Partial<Record<BreakPoint, number>>;
-// type AvatarSize = number | 'large' | 'small' | 'default' | AvatatScreen;
-type AvatarSize = number | 'large' | 'small' | 'default';
-type ImageFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
-
-export interface BaseAvatarProps extends BaseComponentProps {
- alt?: string;
- shape?: Shape;
- size?: AvatarSize;
- src?: string;
- style?: JSX.CSSProperties;
- fit?: ImageFit;
- children?: any;
- onError?: () => void;
- onLoad?: () => void;
- title?: string;
-}
-
-export interface AvatarComponent extends BaseComponent<BaseAvatarProps> {
- render(): JSXComponent<BaseAvatarProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Button.ts b/packages/base-ui/src/Interfaces/Button.ts
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/packages/base-ui/src/Interfaces/Checkbox.ts b/packages/base-ui/src/Interfaces/Checkbox.ts
deleted file mode 100644
index 87275ecfc9..0000000000
--- a/packages/base-ui/src/Interfaces/Checkbox.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { ComponentChildren } from 'react';
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
-
-export interface BaseCheckboxProps extends BaseComponentProps {
- value?: string;
- checked?: boolean;
- className?: string;
- disabled?: boolean;
- name?: string;
- onChange?: (e: Event) => void;
- children?: ComponentChildren;
-}
-
-export interface CheckboxComponent extends BaseComponent<BaseCheckboxProps> {
- render(): JSXComponent<BaseCheckboxProps>;
-}
-
-export type BaseCheckboxGroupOptions = {
- checked?: boolean;
- disabled?: boolean;
- name?: string;
- label?: ComponentChildren;
- value?: string;
-};
-
-export interface BaseCheckboxGroupProps extends BaseComponentProps {
- disabled?: boolean;
- name?: string;
- options: BaseCheckboxGroupOptions[];
- onChange?: (value: string[]) => void;
-}
-
-export interface CheckboxGroupComponent extends BaseComponent<BaseCheckboxGroupProps> {
- render(): JSXComponent<BaseCheckboxGroupProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Collapse.ts b/packages/base-ui/src/Interfaces/Collapse.ts
deleted file mode 100644
index b8e44bea76..0000000000
--- a/packages/base-ui/src/Interfaces/Collapse.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { ComponentChildren } from 'react';
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-
-export interface BasePanelProps {
- children: ComponentChildren;
- header?: ComponentChildren;
-}
-
-export interface BaseCollapseProps {
- children: ComponentChildren;
-}
-
-export interface PanelComponent extends BaseComponent<BasePanelProps> {
- render(): JSXComponent<BasePanelProps>;
-}
-
-export interface CollapseComponent extends BaseComponent<BaseCollapseProps> {
- render(): JSXComponent<BaseCollapseProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/ColorButton.ts b/packages/base-ui/src/Interfaces/ColorButton.ts
deleted file mode 100644
index a93ed0fc56..0000000000
--- a/packages/base-ui/src/Interfaces/ColorButton.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-
-export interface BaseColorButtonProps {
- color: string;
-}
-
-export interface ColorButtonComponent extends BaseComponent<BaseColorButtonProps> {
- render(): JSXComponent<BaseColorButtonProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/ColorPicker.ts b/packages/base-ui/src/Interfaces/ColorPicker.ts
deleted file mode 100644
index 2aa9ddd2cd..0000000000
--- a/packages/base-ui/src/Interfaces/ColorPicker.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
-
-export interface BaseColorPickerProps extends BaseComponentProps {
- /**
- * init color
- */
- color?: string;
-
- /**
- * cancel select
- */
- onCancel?: () => void;
-
- /**
- * Change colors in real time
- */
- onChange?: (color: string, val?: boolean) => void;
-
- /**
- * style
- */
- style?: JSX.CSSProperties;
-
- onClick?: (color: string, e: MouseEvent) => void; // 返回所选颜色
-
- /**
- * class name
- */
- className?: string;
-}
-
-export interface ColorPickerComponent extends BaseComponent<BaseColorPickerProps> {
- render(): JSXComponent<BaseColorPickerProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/ColorPickerCircleButton.ts b/packages/base-ui/src/Interfaces/ColorPickerCircleButton.ts
deleted file mode 100644
index b2eabead72..0000000000
--- a/packages/base-ui/src/Interfaces/ColorPickerCircleButton.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-
-export interface BaseColorPickerCircleButtonProps {
- /**
- * init color
- */
- color: string;
-
- /**
- * Listen to the confirm button
- */
- onClick: (color: string, e?: MouseEvent) => void;
- /**
- * cancel select
- */
- onCancel?: () => void;
-
- /**
- * style
- */
- style?: JSX.CSSProperties;
-
- /**
- * color picker style
- */
- colorPickerStyle?: JSX.CSSProperties;
-}
-
-export interface ColorPickerCircleButtonComponent extends BaseComponent<BaseColorPickerCircleButtonProps> {
- render(): JSXComponent<BaseColorPickerCircleButtonProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Container.ts b/packages/base-ui/src/Interfaces/Container.ts
deleted file mode 100644
index 17299b397c..0000000000
--- a/packages/base-ui/src/Interfaces/Container.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { ComponentChildren } from 'react';
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
-
-export interface BaseContainerProps extends BaseComponentProps {
- children?: ComponentChildren;
- style?: {};
- className?: string;
- onClick?: (e: MouseEvent) => void;
-}
-export interface BaseLayoutProps extends BaseComponentProps {
- children?: ComponentChildren;
- className?: string;
- style?: {};
-}
-
-export interface ContainerComponent extends BaseComponent<BaseContainerProps> {
- render(): JSXComponent<BaseContainerProps>;
-}
-export interface LayoutComponent extends BaseComponent<BaseLayoutProps> {
- render(): JSXComponent<BaseLayoutProps>;
-}
-export interface HeaderComponent extends BaseComponent<BaseLayoutProps> {
- render(): JSXComponent<BaseLayoutProps>;
-}
-export interface FooterComponent extends BaseComponent<BaseLayoutProps> {
- render(): JSXComponent<BaseLayoutProps>;
-}
-export interface SiderComponent extends BaseComponent<BaseLayoutProps> {
- render(): JSXComponent<BaseLayoutProps>;
-}
-export interface ContentComponent extends BaseComponent<BaseLayoutProps> {
- render(): JSXComponent<BaseLayoutProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/CountBar.ts b/packages/base-ui/src/Interfaces/CountBar.ts
index 38fec23a5d..202ce2c2dc 100644
--- a/packages/base-ui/src/Interfaces/CountBar.ts
+++ b/packages/base-ui/src/Interfaces/CountBar.ts
@@ -1,9 +1,6 @@
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
+import { BaseComponentProps } from '../BaseComponent';
+// TODO remove to component file
export interface BaseCountBarProps extends BaseComponentProps {
changeRatio: (ratio: string) => void;
}
-
-export interface CountBarComponent extends BaseComponent<BaseCountBarProps> {
- render(): JSXComponent<BaseCountBarProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/CustomLabel.ts b/packages/base-ui/src/Interfaces/CustomLabel.ts
index d2eeb1fe9a..b3cc3c6b85 100644
--- a/packages/base-ui/src/Interfaces/CustomLabel.ts
+++ b/packages/base-ui/src/Interfaces/CustomLabel.ts
@@ -1,7 +1,4 @@
-import { ComponentChildren } from 'react';
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-import { ICustomComponent } from '../Common';
-import { BaseSelectChildrenProps, DisplayTypes } from '../Components/Select/Select';
+import { BaseSelectChildrenProps } from '../Components/Select/Select';
export interface ICustomLabelProps {
prefix?: string[] | string;
@@ -12,19 +9,8 @@ export interface ICustomLabelProps {
onKeyUp?: (e: Event) => void;
}
+// TODO move to right menu
export interface ICustomLabelType {
name: string;
props?: ICustomLabelProps;
}
-
-export interface IBaseCustomLabelProps {
- icon?: string;
- value?: string;
- label: string | ICustomComponent | ComponentChildren;
- display?: DisplayTypes;
- onChange?: (e: Event) => void;
-}
-
-export interface CustomLabelComponent extends BaseComponent<IBaseCustomLabelProps> {
- render(): JSXComponent<IBaseCustomLabelProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Description.ts b/packages/base-ui/src/Interfaces/Description.ts
deleted file mode 100644
index 3dcff50b72..0000000000
--- a/packages/base-ui/src/Interfaces/Description.ts
+++ /dev/null
@@ -1,280 +0,0 @@
-import { FormatModalComponent } from './FormatModal';
-import { AvatarComponent } from './Avatar';
-import { CheckboxComponent, CheckboxGroupComponent } from './Checkbox';
-import { ColorPickerCircleButtonComponent } from './ColorPickerCircleButton';
-import { SiderModalComponent } from './SiderModal';
-import { ButtonComponent } from '../BaseComponent';
-import { IconComponent } from './Icon';
-import { InputComponent } from './Input';
-import { TabComponent, TabPaneComponent } from './Tab';
-import { RadioComponent, RadioGroupComponent } from './Radio';
-import { ContainerComponent, ContentComponent, FooterComponent, HeaderComponent, LayoutComponent, SiderComponent } from './Container';
-import { SingleButtonComponent } from './SingleButton';
-// import { SelectComponent } from './Select';
-import { ModalComponent } from './Modal';
-import { ColorPickerComponent } from './ColorPicker';
-import { TooltipComponent } from './Tooltip';
-import { CollapseComponent, PanelComponent } from './Collapse';
-import { UlComponent } from './Ul';
-import { SliderComponent } from './Slider';
-import { MenuComponent } from './Menu';
-import { DropdownComponent } from './Dropdown';
-
-export interface Description {
- Button: ButtonComponent;
- SingleButton: SingleButtonComponent;
- // Select: SelectComponent;
- Container: ContainerComponent;
- // CellRangeModal: CellRangeModalComponent;
- Modal: ModalComponent;
- SiderModal: SiderModalComponent;
- Layout: LayoutComponent;
- Header: HeaderComponent;
- Slider: SliderComponent;
- Footer: FooterComponent;
- Content: ContentComponent;
- Sider: SiderComponent;
- Checkbox: CheckboxComponent;
- CheckboxGroup: CheckboxGroupComponent;
- ColorPicker: ColorPickerComponent;
- ColorPickerCircleButton: ColorPickerCircleButtonComponent;
- Input: InputComponent;
- Radio: RadioComponent;
- RadioGroup: RadioGroupComponent;
- Tab: TabComponent;
- TabPane: TabPaneComponent;
- Avatar: AvatarComponent;
- Tooltip: TooltipComponent;
- Ul: UlComponent;
- Collapse: CollapseComponent;
- Panel: PanelComponent;
- FormatModal: FormatModalComponent;
- Menu: MenuComponent;
- Dropdown: DropdownComponent;
-
- // Icon
- NextIcon: IconComponent;
- RightIcon: IconComponent;
- OrderIcon: IconComponent;
- CommentIcon: IconComponent;
- ConditionalFormatIcon: IconComponent;
- ScreenshotIcon: IconComponent;
- CheckIcon: IconComponent;
- SearchIcon: IconComponent;
- ReplaceIcon: IconComponent;
- FreezeIcon: IconComponent;
- PivotableIcon: IconComponent;
- FillColorIcon: IconComponent;
- BoldIcon: IconComponent;
- FullBorderIcon: IconComponent;
- TopBorderIcon: IconComponent;
- BottomBorderIcon: IconComponent;
- LeftBorderIcon: IconComponent;
- RightBorderIcon: IconComponent;
- NoneBorderIcon: IconComponent;
- OuterBorderIcon: IconComponent;
- InnerBorderIcon: IconComponent;
- StripingBorderIcon: IconComponent;
- VerticalBorderIcon: IconComponent;
- MergeIcon: IconComponent;
- SumIcon: IconComponent;
- OrderDESCIcon: IconComponent;
- OrderASCIcon: IconComponent;
- FilterIcon: IconComponent;
- FilterRankIcon: IconComponent;
- CleanIcon: IconComponent;
- DeleteIcon: IconComponent;
- DeleteLineIcon: IconComponent;
- UnderLineIcon: IconComponent;
- ItalicIcon: IconComponent;
- TextColorIcon: IconComponent;
- BackIcon: IconComponent;
- ForwardIcon: IconComponent;
- FormatIcon: IconComponent;
- CorrectIcon: IconComponent;
- LtIcon: IconComponent;
- CloseIcon: IconComponent;
- DropDownIcon: IconComponent;
- MenuIcon: IconComponent;
- HideIcon: IconComponent;
- PhotoIcon: IconComponent;
- LinkIcon: IconComponent;
- ChartIcon: IconComponent;
- LoadingIcon: IconComponent;
- LogoIcon: IconComponent;
- AddNumIcon: IconComponent;
- ReduceNumIcon: IconComponent;
- PercentIcon: IconComponent;
- MoneyIcon: IconComponent;
- FxIcon: IconComponent;
- AddIcon: IconComponent;
- ReduceIcon: IconComponent;
- DivideIcon: IconComponent;
- LockIcon: IconComponent;
- LocationIcon: IconComponent;
- PageIcon: IconComponent;
- RegularIcon: IconComponent;
- LayoutIcon: IconComponent;
- TableIcon: IconComponent;
- ImageIcon: IconComponent;
- LeftAlignIcon: IconComponent;
- CenterAlignIcon: IconComponent;
- RightAlignIcon: IconComponent;
- TopVerticalIcon: IconComponent;
- CenterVerticalIcon: IconComponent;
- BottomVerticalIcon: IconComponent;
- TextRotateIcon: IconComponent;
- TextRotateAngleUpIcon: IconComponent;
- TextRotateAngleDownIcon: IconComponent;
- TextRotateVerticalIcon: IconComponent;
- TextRotateRotationUpIcon: IconComponent;
- TextRotateRotationDownIcon: IconComponent;
- BrIcon: IconComponent;
- OverflowIcon: IconComponent;
- CutIcon: IconComponent;
-
- PrintIcon: IconComponent;
- PrintAreaIcon: IconComponent;
- PrintTitleIcon: IconComponent;
-
- BorderDashDot: IconComponent;
- BorderDashDotDot: IconComponent;
- BorderDashed: IconComponent;
- BorderDotted: IconComponent;
- BorderHair: IconComponent;
- BorderMedium: IconComponent;
- BorderMediumDashDot: IconComponent;
- BorderMediumDashDotDot: IconComponent;
- BorderMediumDashed: IconComponent;
- BorderThick: IconComponent;
- BorderThin: IconComponent;
-}
-
-export enum DescriptionEnum {
- Button,
- SingleButton,
- Select,
- Container,
- CellRangeModal,
- Modal,
- SiderModal,
- Layout,
- Header,
- Footer,
- Content,
- Sider,
- Demo,
- Checkbox,
- CheckboxGroup,
- ColorPicker,
- ColorPickerCircleButton,
- Input,
- Radio,
- RadioGroup,
- Tab,
- TabPane,
- Avatar,
- Tooltip,
- Ul,
- Collapse,
- Panel,
- FormatModal,
- RichText,
-
- // Icon
- NextIcon,
- RightIcon,
- OrderIcon,
- CommentIcon,
- ConditionalFormatIcon,
- ScreenshotIcon,
- CheckIcon,
- SearchIcon,
- ReplaceIcon,
- FreezeIcon,
- PivotableIcon,
- FillColorIcon,
- BoldIcon,
- FullBorderIcon,
- TopBorderIcon,
- BottomBorderIcon,
- LeftBorderIcon,
- RightBorderIcon,
- NoneBorderIcon,
- OuterBorderIcon,
- InnerBorderIcon,
- StripingBorderIcon,
- VerticalBorderIcon,
- MergeIcon,
- SumIcon,
- OrderDESCIcon,
- OrderASCIcon,
- FilterIcon,
- FilterRankIcon,
- CleanIcon,
- DeleteIcon,
- DeleteLineIcon,
- UnderLineIcon,
- ItalicIcon,
- TextColorIcon,
- BackIcon,
- ForwardIcon,
- FormatIcon,
- CorrectIcon,
- LtIcon,
- CloseIcon,
- DropDownIcon,
- MenuIcon,
- HideIcon,
- PhotoIcon,
- LinkIcon,
- ChartIcon,
- LoadingIcon,
- LogoIcon,
- AddNumIcon,
- ReduceNumIcon,
- PercentIcon,
- MoneyIcon,
- FxIcon,
- AddIcon,
- ReduceIcon,
- DivideIcon,
- LockIcon,
- LocationIcon,
- PageIcon,
- RegularIcon,
- LayoutIcon,
- TableIcon,
- ImageIcon,
- LeftAlignIcon,
- CenterAlignIcon,
- RightAlignIcon,
- TopVerticalIcon,
- CenterVerticalIcon,
- BottomVerticalIcon,
- TextRotateIcon,
- TextRotateAngleUpIcon,
- TextRotateAngleDownIcon,
- TextRotateVerticalIcon,
- TextRotateRotationUpIcon,
- TextRotateRotationDownIcon,
- BrIcon,
- OverflowIcon,
- CutIcon,
-
- PrintIcon,
- PrintAreaIcon,
- PrintTitleIcon,
-
- BorderDashDot,
- BorderDashDotDot,
- BorderDashed,
- BorderDotted,
- BorderHair,
- BorderMedium,
- BorderMediumDashDot,
- BorderMediumDashDotDot,
- BorderMediumDashed,
- BorderThick,
- BorderThin,
-}
diff --git a/packages/base-ui/src/Interfaces/Drag.ts b/packages/base-ui/src/Interfaces/Drag.ts
deleted file mode 100644
index 5401101cbb..0000000000
--- a/packages/base-ui/src/Interfaces/Drag.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-
-export interface BaseDragProps {
- isDrag: boolean;
- className: string;
-}
-
-export interface DragComponent extends BaseComponent<BaseDragProps> {
- render(): JSXComponent<BaseDragProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Dropdown.ts b/packages/base-ui/src/Interfaces/Dropdown.ts
deleted file mode 100644
index bf7e454b6e..0000000000
--- a/packages/base-ui/src/Interfaces/Dropdown.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { ComponentChildren } from 'react';
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-import { BaseMenuProps } from './Menu';
-
-export interface BaseDropdownProps {
- children: ComponentChildren;
- /** @deprecated dropdown shouldn't know what is inside */
- menu: BaseMenuProps;
- placement?: 'Left' | 'Right' | 'Top' | 'Bottom';
- showArrow?: boolean;
- icon?: ComponentChildren;
- onClick?: () => void;
- onMainClick?: () => void; //非功能按钮事件
- tooltip?: string;
- content?: ComponentChildren;
-}
-
-export interface DropdownComponent extends BaseComponent<BaseDropdownProps> {
- render(): JSXComponent<BaseDropdownProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/FilterSelect.ts b/packages/base-ui/src/Interfaces/FilterSelect.ts
deleted file mode 100644
index 0095c45836..0000000000
--- a/packages/base-ui/src/Interfaces/FilterSelect.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-
-export interface BaseFilterSelectProps {}
-
-export interface FilterSelectComponent extends BaseComponent<BaseFilterSelectProps> {
- render(): JSXComponent<BaseFilterSelectProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/FormatModal.ts b/packages/base-ui/src/Interfaces/FormatModal.ts
deleted file mode 100644
index b7e7cb507f..0000000000
--- a/packages/base-ui/src/Interfaces/FormatModal.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
-import { BaseModalProps } from './Modal';
-import { BaseUlProps } from './Ul';
-
-export interface BaseFormatModalProps extends BaseUlProps, BaseModalProps, BaseComponentProps {
- children?: any;
-}
-
-export interface FormatModalComponent extends BaseComponent<BaseFormatModalProps> {
- render(): JSXComponent<BaseFormatModalProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Icon.ts b/packages/base-ui/src/Interfaces/Icon.ts
deleted file mode 100644
index 8935884bb0..0000000000
--- a/packages/base-ui/src/Interfaces/Icon.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { ComponentChildren } from 'react';
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
-
-export interface BaseIconProps extends BaseComponentProps {
- spin?: boolean;
- rotate?: number;
- style?: JSX.CSSProperties;
- className?: string;
- children?: ComponentChildren;
- name?: string;
- width?: string;
- height?: string;
-}
-
-export interface IconComponent extends BaseComponent<BaseIconProps> {
- render(): JSXComponent<BaseIconProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/InfoBar.ts b/packages/base-ui/src/Interfaces/InfoBar.ts
deleted file mode 100644
index 9258bac2a9..0000000000
--- a/packages/base-ui/src/Interfaces/InfoBar.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
-
-export interface BaseInfoBarProps extends BaseComponentProps {}
-
-export interface InfoBarComponent extends BaseComponent<BaseInfoBarProps> {
- render(): JSXComponent<BaseInfoBarProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Input.ts b/packages/base-ui/src/Interfaces/Input.ts
deleted file mode 100644
index d911d26018..0000000000
--- a/packages/base-ui/src/Interfaces/Input.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { RefObject } from 'react';
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
-
-export interface BaseInputProps extends BaseComponentProps {
- type?: 'text' | 'button' | 'checkbox' | 'file' | 'hidden' | 'image' | 'password' | 'radio' | 'rest' | 'submit' | 'number';
- value?: string;
- placeholder?: string;
- onChange?: (e: Event) => void;
- onPressEnter?: (e: KeyboardEvent) => void;
- bordered?: boolean;
- disabled?: boolean;
- // maxLength?: number;
- // onPressEnter?: KeyboardEvent;
- onFocus?: (e: Event) => void;
- onBlur?: (e: FocusEvent) => void;
- onClick?: (e: MouseEvent) => void;
- onValueChange?: (value: string) => void;
- className?: string;
- readonly?: boolean;
- id?: string;
- ref?: RefObject<HTMLInputElement>;
-}
-
-export interface InputComponent extends BaseComponent<BaseInputProps> {
- render(): JSXComponent<BaseInputProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Menu.ts b/packages/base-ui/src/Interfaces/Menu.ts
deleted file mode 100644
index 9e45722659..0000000000
--- a/packages/base-ui/src/Interfaces/Menu.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import { ComponentChildren, JSX } from 'react';
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-import { ICustomComponentOption, IValueOption } from '../services/menu/menu';
-import { DisplayTypes } from '../Components/Select/Select';
-
-export interface BaseMenuItem {
- className?: string;
- style?: JSX.CSSProperties;
- label?: ComponentChildren;
- value?: any;
- children?: BaseMenuItem[];
- show?: boolean;
- disabled?: boolean;
- onClick?: (...arg: any) => void;
- border?: boolean;
-}
-
-export interface BaseMenuProps {
- /** @deprecated */
- onClick?: (...arg: any) => void;
- /** @deprecated */
- className?: string;
- /** @deprecated */
- style?: JSX.CSSProperties;
- /** @deprecated */
- parent?: any;
- /** @deprecated */
- dom?: HTMLElement;
- /** @deprecated */
- ref?: any;
- /** @deprecated */
- deep?: number;
- /** @deprecated this is legacy menu mechanism. Do not use it. Use `menuItems` instead. */
- menu?: BaseMenuItem[]; // TODO: should be renamed to `items`
-
- // NOTE: options above are legacy. They are going to be removed after we complete refactoring.
-
- display?: DisplayTypes;
- menuId?: string;
- value?: string | number;
- options?: Array<IValueOption | ICustomComponentOption>;
- onOptionSelect?: (option: IValueOption) => void;
-}
-
-export type BaseMenuState = {
- show: boolean;
- posStyle: BaseMenuStyle;
-};
-
-export type BaseMenuStyle = {
- left?: string;
- right?: string;
- top?: string;
- bottom?: string;
-};
-
-export interface MenuComponent extends BaseComponent<BaseMenuProps> {
- render(): JSXComponent<BaseMenuProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Modal.ts b/packages/base-ui/src/Interfaces/Modal.ts
deleted file mode 100644
index 43ddd0400f..0000000000
--- a/packages/base-ui/src/Interfaces/Modal.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import { ComponentChildren } from 'react';
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-
-export interface BaseModalProps {
- title?: string | JSX.Element;
- width?: number;
- top?: number;
- style?: JSX.CSSProperties;
- children?: ComponentChildren;
- className?: string;
- group?: ModalButtonGroup[];
- maskClick?: () => void;
- /** 模态框是否可以拖动 */
- isDrag?: boolean;
-
- /** 模态框是否可见 */
- visible?: boolean;
-
- /** 是否显示遮罩 */
- mask?: boolean;
-
- /** 是否显示底部 */
- footer?: boolean;
-
- /** 点击遮罩层或右上角叉或取消按钮的回调 */
- onCancel?: (e: Event) => void;
- ref?: any;
-}
-
-export type ModalButtonGroup = {
- locale?: string;
- label?: string;
- onClick?: (e?: any) => void;
- type?: string;
-};
-
-export interface ModalProps extends BaseModalProps {
- show?: boolean;
- locale?: string;
-}
-
-export interface ModalComponent extends BaseComponent<BaseModalProps> {
- render(): JSXComponent<BaseModalProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Radio.ts b/packages/base-ui/src/Interfaces/Radio.ts
deleted file mode 100644
index 2163f260e1..0000000000
--- a/packages/base-ui/src/Interfaces/Radio.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { VNode } from 'react';
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-
-export interface BaseRadioIProps {
- value: string;
- active?: boolean;
- onClick?: () => void;
- label?: string;
- children?: any;
-}
-
-export interface BaseRadioGroupProps {
- className?: string;
- active?: string | number;
- vertical?: boolean;
- onChange: (value: string) => void;
- children: Array<VNode<BaseRadioIProps>>;
-}
-
-export interface RadioComponent extends BaseComponent<BaseRadioIProps> {
- render(): JSXComponent<BaseRadioIProps>;
-}
-
-export interface RadioGroupComponent extends BaseComponent<BaseRadioGroupProps> {
- render(): JSXComponent<BaseRadioGroupProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/ResizeDialog.ts b/packages/base-ui/src/Interfaces/ResizeDialog.ts
deleted file mode 100644
index 6b413cc1bb..0000000000
--- a/packages/base-ui/src/Interfaces/ResizeDialog.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { ComponentChildren } from 'react';
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
-
-export interface BaseResizeDialogProps extends BaseComponentProps {
- left: number;
- top: number;
- width: number;
- height: number;
- children: ComponentChildren;
- ratio: number;
-}
-
-export interface ResizeDialogComponent extends BaseComponent<BaseResizeDialogProps> {
- render(): JSXComponent<BaseResizeDialogProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/RightMenu.ts b/packages/base-ui/src/Interfaces/RightMenu.ts
index d98765002d..3f9514fe4b 100644
--- a/packages/base-ui/src/Interfaces/RightMenu.ts
+++ b/packages/base-ui/src/Interfaces/RightMenu.ts
@@ -1,19 +1,15 @@
-import { ComponentChildren } from 'react';
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
+import { BaseComponentProps } from '../BaseComponent';
export interface List {
- content: ComponentChildren;
+ content: React.ReactNode;
onClick?: () => void;
vertical?: boolean;
type?: string;
children?: List[];
}
+// TODO remove to component file
export interface BaseRightMenuProps extends BaseComponentProps {
onClick?: () => void;
style?: {};
}
-
-export interface RightMenuComponent extends BaseComponent<BaseRightMenuProps> {
- render(): JSXComponent<BaseRightMenuProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/SearchTree.ts b/packages/base-ui/src/Interfaces/SearchTree.ts
deleted file mode 100644
index 04c63b2ed1..0000000000
--- a/packages/base-ui/src/Interfaces/SearchTree.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-
-export interface BaseSearchTreeProps {}
-
-export interface SearchTreeComponent extends BaseComponent<BaseSearchTreeProps> {
- render(): JSXComponent<BaseSearchTreeProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Select.ts b/packages/base-ui/src/Interfaces/Select.ts
deleted file mode 100644
index eda2daa9e5..0000000000
--- a/packages/base-ui/src/Interfaces/Select.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-// import { BaseComponent, JSXComponent } from '../BaseComponent';
-// import { ISelectButtonType } from '../Enum';
-// import { IMainProps } from '../IData';
-
-// export interface BaseSelectProps {
-// label?: string | JSX.Element;
-// selected?: boolean;
-// icon?: JSX.Element | string | null | undefined;
-// tooltip?: string;
-// tooltipRight?: string;
-// onClick?: (...arg: any[]) => void;
-// onKeyUp?: (...arg: any[]) => void;
-// onMouseDown?: (...arg: any[]) => void;
-// triggerUpdate?: (func: Function) => void;
-// needChange?: boolean;
-// selectType?: ISelectButtonType;
-// children: BaseSelectProps[];
-// border?: boolean;
-// className?: string;
-// slot?: {
-// header?: IMainProps;
-// footer?: IMainProps;
-// };
-// value?: string | number;
-// style?: JSX.CSSProperties;
-// }
-
-// export interface SelectComponent extends BaseComponent<BaseSelectProps> {
-// render(): JSXComponent<BaseSelectProps>;
-// }
diff --git a/packages/base-ui/src/Interfaces/SheetBar.ts b/packages/base-ui/src/Interfaces/SheetBar.ts
index 2cb5897f0d..c1f702e09f 100644
--- a/packages/base-ui/src/Interfaces/SheetBar.ts
+++ b/packages/base-ui/src/Interfaces/SheetBar.ts
@@ -1,8 +1,9 @@
import { BooleanNumber } from '@univerjs/core';
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
+import { BaseComponentProps } from '../BaseComponent';
import { BaseSelectProps } from '../Components';
+// TODO move to component file
export interface BaseSheetBarProps extends BaseComponentProps, Omit<BaseSelectProps, 'children'> {
children?: any[];
index?: string;
@@ -17,7 +18,3 @@ export interface BaseSheetBarProps extends BaseComponentProps, Omit<BaseSelectPr
dragEnd?: (elements: HTMLElement[]) => void;
selected?: boolean;
}
-
-export interface SheetBarComponent extends BaseComponent<BaseSheetBarProps> {
- render(): JSXComponent<BaseSheetBarProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/SiderModal.ts b/packages/base-ui/src/Interfaces/SiderModal.ts
deleted file mode 100644
index 9f765a364e..0000000000
--- a/packages/base-ui/src/Interfaces/SiderModal.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { ComponentChildren, RefObject } from 'react';
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-
-export interface BaseSiderModalProps {
- name: string;
- title: string | any;
- show?: boolean;
- children?: ComponentChildren;
- footer?: ComponentChildren;
- ref?: RefObject<HTMLElement>;
- className?: string;
- zIndex?: number;
- style?: JSX.CSSProperties;
-}
-
-export interface SiderModalComponent extends BaseComponent<BaseSiderModalProps> {
- render(): JSXComponent<BaseSiderModalProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/SingleButton.ts b/packages/base-ui/src/Interfaces/SingleButton.ts
deleted file mode 100644
index 7df1dcf33f..0000000000
--- a/packages/base-ui/src/Interfaces/SingleButton.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { BaseComponent, JSXComponent } from '../BaseComponent';
-
-export interface BaseSingleButtonProps {
- label?: string | JSX.Element;
- icon?: JSX.Element | string | null | undefined;
- tooltip?: string;
- name?: string;
- key?: string;
- onClick?: (...arg: any[]) => void;
-}
-
-export interface SingleButtonComponent extends BaseComponent<BaseSingleButtonProps> {
- render(): JSXComponent<BaseSingleButtonProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Slider.ts b/packages/base-ui/src/Interfaces/Slider.ts
deleted file mode 100644
index e78394ed13..0000000000
--- a/packages/base-ui/src/Interfaces/Slider.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { RefObject } from 'react';
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
-
-interface SliderBaseProps {
- min?: number;
- max?: number;
- step?: number;
- className?: string;
- ref?: RefObject<any>;
- style?: JSX.CSSProperties;
-}
-
-export interface BaseSliderSingleProps extends SliderBaseProps, BaseComponentProps {
- range?: false;
- value?: number;
- onChange?: (e: Event) => void;
- onClick?: (e: Event, value: number | string) => void;
-}
-
-export interface BaseSliderRangeProps extends SliderBaseProps, BaseComponentProps {
- range: true;
- value?: [number, number];
- onChange?: (e: Event) => void;
- onClick?: (e: Event, value: number | string) => void;
-}
-
-export interface SliderComponent extends BaseComponent<BaseSliderRangeProps | BaseSliderSingleProps> {
- render(): JSXComponent<BaseSliderRangeProps | BaseSliderSingleProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Tab.ts b/packages/base-ui/src/Interfaces/Tab.ts
deleted file mode 100644
index e1a534cfe9..0000000000
--- a/packages/base-ui/src/Interfaces/Tab.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
-
-interface IProps {
- className?: string;
- style?: JSX.CSSProperties;
- children?: any;
-}
-
-export interface BaseTabPaneProps {
- active?: boolean;
- tab?: JSX.Element | string;
- keys?: string;
- id?: string;
- className?: string;
- style?: JSX.CSSProperties;
- children?: any;
-}
-
-export interface BaseTabProps extends IProps, BaseComponentProps {
- // type?: 'line' | 'card';
- type?: 'card';
- activeKey?: string;
- // defaultActiveKey?: string;
- // tabBarGutter?: number;
- // tabBarStyle?: Record<string, string>;
- // tabPosition?: 'left' | 'right' | 'top' | 'bottom';
- // onChange?: (activeKey: string) => void;
- onTabClick?: (activeKey: string, e: Event) => void;
-}
-
-export interface TabComponent extends BaseComponent<BaseTabProps> {
- render(): JSXComponent<BaseTabProps>;
-}
-
-export interface TabPaneComponent extends BaseComponent<BaseTabPaneProps> {
- render(): JSXComponent<BaseTabPaneProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Tooltip.ts b/packages/base-ui/src/Interfaces/Tooltip.ts
deleted file mode 100644
index 587c01ddc6..0000000000
--- a/packages/base-ui/src/Interfaces/Tooltip.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { ComponentChildren } from 'react';
-import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
-
-export interface BaseTooltipProps extends BaseComponentProps {
- [index: number]: string;
-
- title?: string;
- shortcut?: string;
- children: ComponentChildren;
- placement?: string;
- color?: string;
- styles?: {};
-}
-
-export interface TooltipComponent extends BaseComponent<BaseTooltipProps> {
- render(): JSXComponent<BaseTooltipProps>;
-}
diff --git a/packages/base-ui/src/Interfaces/Ul.ts b/packages/base-ui/src/Interfaces/Ul.ts
index c5a17dbdb0..9f708b7dfa 100644
--- a/packages/base-ui/src/Interfaces/Ul.ts
+++ b/packages/base-ui/src/Interfaces/Ul.ts
@@ -2,6 +2,7 @@ import { BooleanNumber } from '@univerjs/core';
import { BaseComponent, BaseComponentProps, JSXComponent } from '../BaseComponent';
+// TODO move to component file
export interface BaseUlProps extends BaseComponentProps {
label?: string | JSX.Element | string[];
/**
@@ -18,7 +19,7 @@ export interface BaseUlProps extends BaseComponentProps {
onClick?: (...arg: any[]) => void;
onKeyUp?: (...any: any[]) => void;
onMouseDown?: (...any: any[]) => void;
- style?: JSX.CSSProperties;
+ style?: React.CSSProperties;
showSelect?: (e: MouseEvent) => void;
getParent?: any;
show?: boolean;
@@ -31,8 +32,4 @@ export interface BaseUlProps extends BaseComponentProps {
* 是否隐藏当前item
*/
hideLi?: boolean;
-}
-
-export interface UlComponent extends BaseComponent<BaseUlProps> {
- render(): JSXComponent<BaseUlProps>;
-}
+}
\ No newline at end of file
diff --git a/packages/base-ui/src/Interfaces/index.ts b/packages/base-ui/src/Interfaces/index.ts
index ab456f489c..c9436615de 100644
--- a/packages/base-ui/src/Interfaces/index.ts
+++ b/packages/base-ui/src/Interfaces/index.ts
@@ -1,30 +1,5 @@
-export * from './Avatar';
-export * from './Checkbox';
-export * from './Collapse';
-export * from './ColorButton';
-export * from './ColorPicker';
-export * from './ColorPickerCircleButton';
-export * from './Container';
export * from './CountBar';
export * from './CustomLabel';
-export * from './Drag';
-export * from './FilterSelect';
-// export * from './FormatModal';
-export * from './Icon';
-export * from './InfoBar';
-export * from './Input';
-export * from './Menu';
-export * from './Modal';
-export * from './Radio';
-export * from './ResizeDialog';
export * from './RightMenu';
-export * from './SearchTree';
export * from './SheetBar';
-export * from './SiderModal';
-export * from './SingleButton';
-export * from './Slider';
-export * from './Tab';
-export * from './Tooltip';
export * from './Ul';
-export * from './Description';
-export * from './Dropdown';
diff --git a/packages/base-ui/src/Utils/util.ts b/packages/base-ui/src/Utils/util.ts
index a61b298394..48f5da9780 100644
--- a/packages/base-ui/src/Utils/util.ts
+++ b/packages/base-ui/src/Utils/util.ts
@@ -22,7 +22,7 @@ export function $$(selector: string, context?: HTMLElement | Document) {
}
/**
- * add classname
+ * add className
* @param className
* @param selector
* @param context
@@ -41,7 +41,7 @@ export function addClass(className: string, selector: HTMLElement | string, cont
});
}
/**
- * remove classname
+ * remove className
* @param className
* @param selector
* @param context
diff --git a/packages/base-ui/src/services/menu/menu.ts b/packages/base-ui/src/services/menu/menu.ts
index 414d09135c..b1c614b430 100644
--- a/packages/base-ui/src/services/menu/menu.ts
+++ b/packages/base-ui/src/services/menu/menu.ts
@@ -85,6 +85,7 @@ export function isValueOptions(v: IValueOption | ICustomComponentOption): v is I
export interface ICustomComponentOption {
id: string;
+ disabled?: boolean;
}
export interface ICustomComponentProps<T> {
diff --git a/packages/core/src/Sheets/Domain/Color.ts b/packages/core/src/Sheets/Domain/Color.ts
index d481290b28..d1e1d7dcc8 100644
--- a/packages/core/src/Sheets/Domain/Color.ts
+++ b/packages/core/src/Sheets/Domain/Color.ts
@@ -290,19 +290,19 @@ export class RgbColor extends Color {
return this._alpha;
}
- getColorType(): ColorType {
+ override getColorType(): ColorType {
return ColorType.RGB;
}
- clone(): RgbColor {
+ override clone(): RgbColor {
return new RgbColor(this._cssString, this._builder);
}
- asThemeColor(): ThemeColor {
+ override asThemeColor(): ThemeColor {
throw new Error('rgb color not support to themeColor');
}
- equals(color: Color): boolean {
+ override equals(color: Color): boolean {
if (color instanceof RgbColor) {
return color._red === this._red && color._blue === this._blue && color._green === this._green && color._alpha === this._alpha;
}
@@ -346,7 +346,7 @@ export class ThemeColor extends Color {
return value;
}
- asRgbColor(): RgbColor {
+ override asRgbColor(): RgbColor {
const themeColors = THEME_COLORS[this._themeColors];
if (themeColors == null) {
throw new Error('not find themeColors type');
@@ -376,18 +376,18 @@ export class ThemeColor extends Color {
return rgbColor;
}
- clone(): ThemeColor {
+ override clone(): ThemeColor {
return new ThemeColor(this._themeColorType, this._themeTint, this._themeColors, this._builder);
}
- equals(color: Color): boolean {
+ override equals(color: Color): boolean {
if (color instanceof ThemeColor) {
return color._themeColorType === this._themeColorType;
}
return false;
}
- getColorType(): ColorType {
+ override getColorType(): ColorType {
return ColorType.THEME;
}
diff --git a/packages/core/src/Sheets/Domain/Range.ts b/packages/core/src/Sheets/Domain/Range.ts
index 992eea1152..b31de5830a 100644
--- a/packages/core/src/Sheets/Domain/Range.ts
+++ b/packages/core/src/Sheets/Domain/Range.ts
@@ -856,41 +856,6 @@ export class Range {
return this;
}
- /**
- * Sets the specified range as the active range, with the top left cell in the range as the current cell.
- *
- * @returns This range, for chaining.
- * @internal
- */
- activate(): Range {
- // The user entered an invalid range
- if (this._rangeData?.startRow === -1) {
- console.error('Invalid range,default set startRow -1');
- return this;
- }
-
- this._worksheet.getSelection().setSelection({ selection: this });
-
- // This range, for chaining
- return this;
- }
-
- /**
- * Sets the specified cell as the current cell.
- *
- * If the specified cell is present in an existing range, then that range becomes the active range with the cell as the current cell.
- *
- * If the specified cell is not present in any existing range, then the existing selection is removed and the cell becomes the current cell and the active range.
- *
- * Note: The specified Range must consist of one cell, otherwise it throws an exception.
- *
- * @returns This range, for chaining.
- */
- activateAsCurrentCell(): Range {
- this._worksheet.getSelection().setCurrentCell(this);
- return this;
- }
-
/**
* Whether the current range and the incoming range have an intersection
*
diff --git a/packages/core/test/Basics/UniverSheet.test.ts b/packages/core/test/Basics/UniverSheet.test.ts
deleted file mode 100644
index f9f5d0655c..0000000000
--- a/packages/core/test/Basics/UniverSheet.test.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { SheetContext, UniverSheet, Plugin } from '../../src';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-describe('UniverSheet', () => {
- let univerSheet: UniverSheet;
- beforeAll(async () => {
- univerSheet = UniverSheet.newInstance({
- id: 'workbook-01',
- sheets: {
- 'sheet-01': {
- name: 'first sheet',
- id: 'sheet-01',
- },
- },
- });
- });
- afterAll(async () => {});
-
- test('Test newInstance', () => {
- let sheet = univerSheet.getWorkBook().getSheetBySheetName('first sheet');
- expect(sheet && sheet.getName()).toEqual('first sheet');
- });
- test('Test installPlugin/uninstallPlugin/getWorkBook/get context', () => {
- class TestPlugin extends Plugin {
- context: SheetContext;
-
- constructor() {
- super('testPlugin');
- }
-
- initialize(context: SheetContext): void {
- this.context = context;
- }
-
-
-
- onMounted(ctx: SheetContext): void {
- this.initialize(ctx);
- }
-
- onDestroy(): void {}
- }
-
- // test installPlugin
- univerSheet.installPlugin(new TestPlugin());
-
- // test getWorkBook
- let plugin = univerSheet
- .getWorkBook()
- .getContext()
- .getPluginManager()
- .getPluginByName<TestPlugin>('testPlugin');
-
- plugin?.getPluginByName<TestPlugin>('testPlugin');
- expect(plugin && plugin.getPluginName()).toEqual('testPlugin');
-
- // test uninstallPlugin
- univerSheet.uninstallPlugin('testPlugin');
-
- let uninstalledPlugin = univerSheet
- .getWorkBook()
- .getContext()
- .getPluginManager()
- .getPluginByName<TestPlugin>('testPlugin');
- expect(uninstalledPlugin).toEqual(undefined);
- });
-
- test('Test SheetContext', () => {
- // test get context
- let context = univerSheet.context;
-
- let undoManager = context.getUndoManager();
- let observerManager = context.getObserverManager();
- let locale = context.getLocale();
- let pluginManager = context.getPluginManager();
- let hooksManager = context.getHooksManager();
-
- expect(undoManager).not.toBeNull();
- expect(observerManager).not.toBeNull();
- expect(locale).not.toBeNull();
- expect(pluginManager).not.toBeNull();
- expect(hooksManager).not.toBeNull();
- });
-});
diff --git a/packages/core/test/Command/ActionOperation.test.ts b/packages/core/test/Command/ActionOperation.test.ts
deleted file mode 100644
index 5e592e9caa..0000000000
--- a/packages/core/test/Command/ActionOperation.test.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { ISheetActionData } from '../../src';
-import { ActionOperation } from '../../src/Command/ActionOperation';
-
-test('ActionOperation case1', () => {
- const operation1 = ActionOperation.make<ISheetActionData>({
- sheetId: 'sheet1',
- actionName: 'testAction',
- });
- expect(ActionOperation.hasObserver(operation1.getAction())).toBeTruthy();
- expect(ActionOperation.hasUndo(operation1.getAction())).toBeTruthy();
- expect(ActionOperation.hasCollaboration(operation1.getAction())).toBeTruthy();
-
- const operation2 = ActionOperation.make({
- sheetId: 'sheet1',
- actionName: 'testAction',
- })
- .removeUndo()
- .removeObserver();
- expect(ActionOperation.hasUndo(operation2.getAction())).toBeFalsy();
- expect(ActionOperation.hasObserver(operation2.getAction())).toBeFalsy();
- expect(ActionOperation.hasCollaboration(operation1.getAction())).toBeTruthy();
-});
diff --git a/packages/core/test/Command/AddMergeAction.test.ts b/packages/core/test/Command/AddMergeAction.test.ts
deleted file mode 100644
index f16f3984b6..0000000000
--- a/packages/core/test/Command/AddMergeAction.test.ts
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { SheetContext } from '../../src/Basics';
-import { AddMergeAction, CommandManager } from '../../src/Command';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Test Create MergeCell', () => {
- const container = createCoreTestContainer();
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'AddMergeAction';
- const rect = [{ startRow: 1, startColumn: 1, endRow: 5, endColumn: 5 }];
-
- const configure = { actionName, sheetId, rectangles: rect };
- new AddMergeAction(configure, workbook, observers);
- expect(worksheet.getMerges().size()).toEqual(1);
-});
-
-test('Test Undo MergeCell', () => {
- const container = createCoreTestContainer();
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'AddMergeAction';
- const rect = [{ startRow: 1, startColumn: 1, endRow: 5, endColumn: 5 }];
-
- const configure = { actionName, sheetId, rectangles: rect };
- const action = new AddMergeAction(configure, workbook, observers);
- expect(worksheet.getMerges().size()).toEqual(1);
- action.undo();
- expect(worksheet.getMerges().size()).toEqual(0);
- action.redo();
- expect(worksheet.getMerges().size()).toEqual(1);
-});
-
-test('Test Cross MergeCell', () => {
- const container = createCoreTestContainer();
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'AddMergeAction';
-
- const rect1 = [{ startRow: 1, startColumn: 1, endRow: 5, endColumn: 5 }];
- const config1 = { actionName, sheetId, rectangles: rect1 };
- new AddMergeAction(config1, workbook, observers);
- expect(worksheet.getMerges().size()).toEqual(1);
-
- const rect2 = [{ startRow: 2, startColumn: 2, endRow: 5, endColumn: 5 }];
- const config2 = { actionName, sheetId, rectangles: rect2 };
- new AddMergeAction(config2, workbook, observers);
- expect(worksheet.getMerges().size()).toEqual(1);
-});
-
-test('Test Multiple MergeCell', () => {
- const container = createCoreTestContainer();
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'AddMergeAction';
-
- const rect1 = [{ startRow: 1, startColumn: 1, endRow: 5, endColumn: 5 }];
- const config1 = { actionName, sheetId, rectangles: rect1 };
- new AddMergeAction(config1, workbook, observers);
- expect(worksheet.getMerges().size()).toEqual(1);
-
- const rect2 = [{ startRow: 10, startColumn: 10, endRow: 15, endColumn: 15 }];
- const config2 = { actionName, sheetId, rectangles: rect2 };
- new AddMergeAction(config2, workbook, observers);
- expect(worksheet.getMerges().size()).toEqual(2);
-});
diff --git a/packages/core/test/Command/InsertRowAction.test.ts b/packages/core/test/Command/InsertRowAction.test.ts
deleted file mode 100644
index 8f082001d4..0000000000
--- a/packages/core/test/Command/InsertRowAction.test.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { SheetContext } from '../../src/Basics';
-import { CommandManager, InsertRowAction } from '../../src/Command';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Undo a new Row', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'InsertRowAction';
- const configure = {
- actionName,
- sheetId,
- rowIndex: 0,
- rowCount: 1,
- };
- const action = new InsertRowAction(configure, workbook, observers);
- expect(worksheet.getRowManager().getSize()).toEqual(1);
- action.undo();
- expect(worksheet.getRowManager().getSize()).toEqual(0);
- action.redo();
- expect(worksheet.getRowManager().getSize()).toEqual(1);
-});
-
-test('Insert a new Row', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'InsertRowAction';
- const configure = {
- actionName,
- sheetId,
- rowIndex: 0,
- rowCount: 1,
- };
- new InsertRowAction(configure, workbook, observers);
- expect(worksheet.getRowManager().getSize()).toEqual(1);
-});
diff --git a/packages/core/test/Command/RemoveMergeAction.test.ts b/packages/core/test/Command/RemoveMergeAction.test.ts
deleted file mode 100644
index f032c2c6a2..0000000000
--- a/packages/core/test/Command/RemoveMergeAction.test.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { SheetContext } from '../../src/Basics';
-import {
- AddMergeAction,
- CommandManager,
- RemoveMergeAction,
-} from '../../src/Command';
-import { createCoreTestContainer } from '../ContainerStartUp';
-import { IRangeData } from '../../src/Types/Interfaces';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Remove a new merge', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
- const observers = CommandManager.getActionObservers();
-
- // add merge
- const actionNameAdd = 'AddMergeAction';
- const rect: IRangeData[] = [
- { startRow: 1, startColumn: 1, endRow: 5, endColumn: 5 },
- ];
-
- const configureAdd = { actionName: actionNameAdd, sheetId, rectangles: rect };
- const mergeAction = new AddMergeAction(configureAdd, workbook, observers);
-
- // remove merge
- const actionNameRemove = 'RemoveMergeAction';
- const rectangles: IRangeData[] = [
- { startRow: 1, startColumn: 1, endRow: 5, endColumn: 5 },
- ];
- const configureRemove = {
- actionName: actionNameRemove,
- sheetId,
- rectangles,
- };
- const action = new RemoveMergeAction(configureRemove, workbook, observers);
- expect(worksheet.getMerges().size()).toEqual(0);
-
- action.undo();
- expect(worksheet.getMerges().size()).toEqual(1);
- action.redo();
- expect(worksheet.getMerges().size()).toEqual(0);
-});
diff --git a/packages/core/test/Command/RemoveRowDataAction.test.ts b/packages/core/test/Command/RemoveRowDataAction.test.ts
deleted file mode 100644
index ab975c5028..0000000000
--- a/packages/core/test/Command/RemoveRowDataAction.test.ts
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { SheetContext } from '../../src/Basics';
-import { CommandManager, RemoveRowDataAction } from '../../src/Command';
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Insert a new Row', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const data = {
- sheetId: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, data);
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'RemoveRowDataAction';
- const configure = {
- actionName,
- sheetId: data.sheetId,
- rowIndex: 0,
- rowCount: 1,
- };
- const action = new RemoveRowDataAction(configure, workbook, observers);
- expect(worksheet.getRowManager().getSize()).toEqual(2);
- action.undo();
- action.redo();
-});
diff --git a/packages/core/test/Command/RowRemoveAction.test.ts b/packages/core/test/Command/RowRemoveAction.test.ts
deleted file mode 100644
index 36d0f49f48..0000000000
--- a/packages/core/test/Command/RowRemoveAction.test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import {
- CommandManager,
- SheetContext,
- RemoveRowAction,
- Workbook,
- Worksheet,
-} from '../../src';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Remove a new column', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const rowData = { 0: { hd: 0, h: 50 } };
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId, rowData });
- workbook.insertSheet(worksheet);
- expect(worksheet.getRowManager().getSize()).toEqual(1);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'RemoveRowAction';
- const configure = {
- actionName,
- sheetId,
- rowIndex: 0,
- rowCount: 1,
- };
- new RemoveRowAction(configure, workbook, observers);
- expect(worksheet.getRowManager().getSize()).toEqual(0);
-});
-
-test('Remove Undo column', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const rowData = { 0: { hd: 0, h: 50 } };
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId, rowData });
- workbook.insertSheet(worksheet);
- expect(worksheet.getRowManager().getSize()).toEqual(1);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'RemoveRowAction';
- const configure = {
- actionName,
- sheetId,
- rowIndex: 0,
- rowCount: 1,
- };
- const action = new RemoveRowAction(configure, workbook, observers);
- expect(worksheet.getRowManager().getSize()).toEqual(0);
- action.undo();
- expect(worksheet.getRowManager().getSize()).toEqual(1);
- action.redo();
- expect(worksheet.getRowManager().getSize()).toEqual(0);
-});
diff --git a/packages/core/test/Command/SetCollapseAllColumnGroupsAction.test.ts b/packages/core/test/Command/SetCollapseAllColumnGroupsAction.test.ts
deleted file mode 100644
index e52dd88518..0000000000
--- a/packages/core/test/Command/SetCollapseAllColumnGroupsAction.test.ts
+++ /dev/null
@@ -1 +0,0 @@
-test('', () => {});
diff --git a/packages/core/test/Command/SetCollapseAllRowGroupsAction.test.ts b/packages/core/test/Command/SetCollapseAllRowGroupsAction.test.ts
deleted file mode 100644
index e52dd88518..0000000000
--- a/packages/core/test/Command/SetCollapseAllRowGroupsAction.test.ts
+++ /dev/null
@@ -1 +0,0 @@
-test('', () => {});
diff --git a/packages/core/test/Command/SetHideColumnAction.test.ts b/packages/core/test/Command/SetHideColumnAction.test.ts
deleted file mode 100644
index f4442bddc8..0000000000
--- a/packages/core/test/Command/SetHideColumnAction.test.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { createCoreTestContainer } from '../ContainerStartUp';
-import { SheetContext } from '../../src/Basics';
-import {
- CommandManager,
- SetColumnHideAction,
- SetColumnShowAction,
-} from '../../src/Command';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Set a hide Column', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'SetColumnHideAction';
- const configure = { actionName, sheetId, columnIndex: 1, columnCount: 1 };
- const action = new SetColumnHideAction(configure, workbook, observers);
-
- expect(worksheet.getColumnManager().getColumnOrCreate(1).hd).toEqual(true);
-
- action.undo();
- expect(worksheet.getColumnManager().getColumnOrCreate(1).hd).toEqual(false);
- action.redo();
- expect(worksheet.getColumnManager().getColumnOrCreate(1).hd).toEqual(true);
-
- const actionNameShow = 'SetColumnShowAction';
- const configureShow = {
- actionName: actionNameShow,
- sheetId,
- columnIndex: 1,
- columnCount: 1,
- };
- workbook.insertSheet(worksheet);
- const actionShow = new SetColumnShowAction(configureShow, workbook, observers);
-
- expect(worksheet.getColumnManager().getColumnOrCreate(1).hd).toEqual(false);
-
- actionShow.undo();
- expect(worksheet.getColumnManager().getColumnOrCreate(1).hd).toEqual(true);
- actionShow.redo();
- expect(worksheet.getColumnManager().getColumnOrCreate(1).hd).toEqual(false);
-});
diff --git a/packages/core/test/Command/SetHideRowAction.test.ts b/packages/core/test/Command/SetHideRowAction.test.ts
deleted file mode 100644
index 78bbff3f7e..0000000000
--- a/packages/core/test/Command/SetHideRowAction.test.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { SheetContext } from '../../src/Basics';
-import {
- CommandManager,
- SetRowHideAction,
- SetRowShowAction,
-} from '../../src/Command';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('SetRowHideAction', () => {
- const observers = CommandManager.getActionObservers();
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const actionName = 'SetRowHideAction';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
-
- const configure = { actionName, sheetId, rowIndex: 1, rowCount: 1 };
- const action = new SetRowHideAction(configure, workbook, observers);
-
- expect(worksheet.getRowManager().getRowOrCreate(1).hd).toEqual(true);
-
- action.undo();
- expect(worksheet.getRowManager().getRowOrCreate(1).hd).toEqual(false);
- action.redo();
- expect(worksheet.getRowManager().getRowOrCreate(1).hd).toEqual(true);
-
- const actionNameShow = 'SetRowShowAction';
- const configureShow = {
- actionName: actionNameShow,
- sheetId,
- rowIndex: 1,
- rowCount: 1,
- };
- const actionShow = new SetRowShowAction(configureShow, workbook, observers);
-
- expect(worksheet.getRowManager().getRowOrCreate(1).hd).toEqual(false);
-
- actionShow.undo();
- expect(worksheet.getRowManager().getRowOrCreate(1).hd).toEqual(true);
- actionShow.redo();
- expect(worksheet.getRowManager().getRowOrCreate(1).hd).toEqual(false);
-});
diff --git a/packages/core/test/Command/SetRangeDataAction.test.ts b/packages/core/test/Command/SetRangeDataAction.test.ts
deleted file mode 100644
index 7e8b90e5c3..0000000000
--- a/packages/core/test/Command/SetRangeDataAction.test.ts
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { SheetContext } from '../../src/Basics';
-import {
- CommandManager,
- ICellData,
- ISetRangeDataActionData,
- ObjectMatrixPrimitiveType,
- SetRangeDataAction,
-} from '../../src';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Test SetRangeDataAction', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'SetRangeDataAction';
-
- // mock data
- const cellValue: ObjectMatrixPrimitiveType<ICellData> = {
- 0: {
- 0: {
- v: 1,
- m: '1',
- },
- },
- };
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 0,
- };
- const configure: ISetRangeDataActionData = {
- actionName,
- sheetId,
- cellValue,
- };
-
- const action = new SetRangeDataAction(
- configure,
- {
- WorkBookUnit: workbook,
- },
- observers
- );
-
- const value = worksheet.getCellMatrix().getValue(0, 0);
- expect(value && value.v).toEqual(1);
-
- action.undo();
-
- const preValue = worksheet.getCellMatrix().getValue(0, 0);
-
- expect(preValue && preValue.v).toEqual(undefined);
-
- action.redo();
-
- const nextValue = worksheet.getCellMatrix().getValue(0, 0);
- expect(nextValue && nextValue.v).toEqual(1);
-});
diff --git a/packages/core/test/Command/SetRangeValueAction.test.ts b/packages/core/test/Command/SetRangeValueAction.test.ts
deleted file mode 100644
index 56ca53c8fe..0000000000
--- a/packages/core/test/Command/SetRangeValueAction.test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { SheetContext } from '../../src/Basics';
-import {
- SetRangeFormattedValueAction,
- CommandManager,
- ISetRangeFormattedValueActionData,
-} from '../../src/Command';
-import { ICellV, ObjectMatrixPrimitiveType } from '../../src';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Test SetRangeFormattedValueAction', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'SetRangeFormattedValueAction';
-
- // mock data
- const cellValue: ObjectMatrixPrimitiveType<ICellV> = {
- 0: {
- 0: 1,
- },
- };
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 0,
- };
- const configure: ISetRangeFormattedValueActionData = {
- actionName,
- sheetId,
- cellValue,
- rangeData,
- };
-
- const action = new SetRangeFormattedValueAction(configure, workbook, observers);
-
- const value = worksheet.getCellMatrix().getValue(0, 0);
- expect(value && value.v).toEqual(1);
-
- action.undo();
-
- const preValue = worksheet.getCellMatrix().getValue(0, 0);
-
- expect(preValue && preValue.v).toEqual('');
-
- action.redo();
-
- const nextValue = worksheet.getCellMatrix().getValue(0, 0);
- expect(nextValue && nextValue.v).toEqual(1);
-});
diff --git a/packages/core/test/Command/SetShowColumnAction.test.ts b/packages/core/test/Command/SetShowColumnAction.test.ts
deleted file mode 100644
index 96f423eb87..0000000000
--- a/packages/core/test/Command/SetShowColumnAction.test.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { SheetContext } from '../../src/Basics';
-import { CommandManager, SetColumnShowAction } from '../../src/Command';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('SetColumnShowAction', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId });
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'SetColumnShowAction';
- const configure = { actionName, sheetId, columnIndex: 1, columnCount: 1 };
- workbook.insertSheet(worksheet);
- new SetColumnShowAction(configure, workbook, observers);
-});
diff --git a/packages/core/test/Command/SetShowRowAction.test.ts b/packages/core/test/Command/SetShowRowAction.test.ts
deleted file mode 100644
index 9754adeb28..0000000000
--- a/packages/core/test/Command/SetShowRowAction.test.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { SheetContext } from '../../src/Basics';
-import { createCoreTestContainer } from '../ContainerStartUp';
-import { CommandManager, SetRowShowAction } from '../../src/Command';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('SetRowShowAction', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = 'SetRowShowAction';
- const configure = { actionName, sheetId, rowIndex: 1, rowCount: 1 };
- new SetRowShowAction(configure, workbook, observers);
-});
diff --git a/packages/core/test/Command/SetWorkSheetHideAction.test.ts b/packages/core/test/Command/SetWorkSheetHideAction.test.ts
deleted file mode 100644
index aa415ee05a..0000000000
--- a/packages/core/test/Command/SetWorkSheetHideAction.test.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { SheetContext } from '../../src/Basics';
-import { CommandManager, SetWorkSheetHideAction } from '../../src/Command';
-import { ACTION_NAMES } from '../../src/Types/Const';
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { BooleanNumber } from '../../src/Types/Enum';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-test('Set WorkSheet Hide', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const sheetId = 'sheet-01';
- const worksheet = new Worksheet(context, { id: sheetId });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = ACTION_NAMES.HIDE_SHEET_ACTION;
- const configure = {
- actionName,
- sheetId,
- hidden: BooleanNumber.TRUE,
- };
- const action = new SetWorkSheetHideAction(configure, workbook, observers);
- expect(worksheet.isSheetHidden()).toEqual(1);
-
- action.undo();
- expect(worksheet.isSheetHidden()).toEqual(0);
- action.redo();
- expect(worksheet.isSheetHidden()).toEqual(1);
-});
diff --git a/packages/core/test/Command/SetWorkSheetNameAction.test.ts b/packages/core/test/Command/SetWorkSheetNameAction.test.ts
deleted file mode 100644
index 832087a9a6..0000000000
--- a/packages/core/test/Command/SetWorkSheetNameAction.test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { SheetContext } from '../../src/Basics';
-import { createCoreTestContainer } from '../ContainerStartUp';
-import { CommandManager, SetWorkSheetNameAction } from '../../src/Command';
-import { ACTION_NAMES } from '../../src/Types/Const';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Set WorkSheet Name', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const name = 'sheet1';
- const worksheet = new Worksheet(context, { id: sheetId, name });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = ACTION_NAMES.SET_WORKSHEET_NAME_ACTION;
- const sheetName = 'test';
- const configure = {
- actionName,
- sheetId,
- sheetName,
- };
- const action = new SetWorkSheetNameAction(configure, workbook, observers);
- expect(worksheet.getName()).toEqual('test');
-
- action.undo();
- expect(worksheet.getName()).toEqual('sheet1');
- action.redo();
- expect(worksheet.getName()).toEqual('test');
-});
diff --git a/packages/core/test/Command/SetWorkSheetStatusAction.test.ts b/packages/core/test/Command/SetWorkSheetStatusAction.test.ts
deleted file mode 100644
index a7ed675cf5..0000000000
--- a/packages/core/test/Command/SetWorkSheetStatusAction.test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { SheetContext } from '../../src/Basics';
-import { CommandManager, SetWorkSheetStatusAction } from '../../src/Command';
-import { ACTION_NAMES } from '../../src/Types/Const';
-import { Workbook, Worksheet } from '../../src/Sheets/Domain';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Set WorkSheet Status', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
-
- const sheetId = 'sheet1';
- const status = 1;
- const worksheet = new Worksheet(context, { id: sheetId, status });
- workbook.insertSheet(worksheet);
-
- const observers = CommandManager.getActionObservers();
- const actionName = ACTION_NAMES.SET_WORKSHEET_STATUS_ACTION;
- const newStatus = 0;
- const configure = {
- actionName,
- sheetId,
- sheetStatus: newStatus,
- };
- const action = new SetWorkSheetStatusAction(configure, workbook, observers);
- expect(worksheet.getStatus()).toEqual(0);
-
- action.undo();
- expect(worksheet.getStatus()).toEqual(1);
- action.redo();
- expect(worksheet.getStatus()).toEqual(0);
-});
diff --git a/packages/core/test/ContainerStartUp.ts b/packages/core/test/ContainerStartUp.ts
deleted file mode 100644
index 8d7ec8f2ba..0000000000
--- a/packages/core/test/ContainerStartUp.ts
+++ /dev/null
@@ -1,163 +0,0 @@
-import { Injector } from '../src';
-import { Environment, SheetContext } from '../src/Basics';
-import { HooksManager } from '../src/Observer/HooksManager';
-import { ObserverManager } from '../src/Observer/ObserverManager';
-import { PluginManager } from '../src/Plugin';
-import { IServerSocketWorkbookConfig, ServerHttp, ServerSocket } from '../src/Server';
-import { Locale } from '../src/Shared';
-import { Workbook, Worksheet } from '../src/Sheets/Domain';
-import { BooleanNumber } from '../src/Types/Enum';
-import { IWorkbookConfig, IWorksheetConfig } from '../src/Types/Interfaces';
-
-export function createCoreTestContainer(workbookConfig?: Partial<IWorkbookConfig>): Injector {
- const configure = {
- value: {
- appVersion: '',
- createdTime: '',
- creator: '',
- extensions: [],
- id: '',
- lastModifiedBy: '',
- locale: '',
- modifiedTime: '',
- name: '',
- namedRanges: [],
- sheetOrder: [],
- sheets: [],
- skin: '',
- socketEnable: BooleanNumber.FALSE,
- socketUrl: '',
- styles: {},
- theme: '',
- timeZone: '',
- ...workbookConfig,
- },
- };
-
- const container = new Injector([
- [IServerSocketWorkbookConfig, { useValue: configure }],
- ['Environment', { useClass: Environment }],
- ['Server', { useClass: ServerSocket }],
- ['ServerSocket', { useClass: ServerSocket }],
- ['ServerHttp', { useClass: ServerHttp }],
- ['WorkBook', { useClass: Workbook }],
- ['Locale', { useClass: Locale }],
- ['Context', { useClass: SheetContext }],
- ['PluginManager', { useClass: PluginManager }],
- ['ObserverManager', { useClass: ObserverManager }],
- ['ObservableHooksManager', { useClass: HooksManager }],
- ['WorkSheet', { useClass: Worksheet }],
- ]);
-
- return container;
-}
-
-const defaultWorksheetConfigure = {
- sheetId: 'sheet-01',
- cellData: {
- 0: {
- 0: {
- s: 1,
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- v: 2,
- m: '2',
- },
- },
- },
- defaultColumnWidth: 93,
- defaultRowHeight: 27,
- status: 1,
-};
-
-export function TestInit(worksheetConfig?: Partial<IWorksheetConfig>) {
- const configure = Object.assign(defaultWorksheetConfigure, worksheetConfig);
-
- const container = createCoreTestContainer();
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- // const worksheet = new WorkSheet(context, configure);
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- return { worksheet, workbook };
-}
-
-// eslint-disable-next-line max-lines-per-function
-export function TestInitTwoSheet() {
- const container = createCoreTestContainer();
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetOneConfigure = {
- sheetId: 'sheet-01',
- cellData: {
- 0: {
- 0: {
- s: 1,
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- v: 2,
- m: '2',
- },
- },
- },
- defaultColumnWidth: 93,
- defaultRowHeight: 27,
- status: 1,
- };
-
- const sheetTwoConfigure = {
- sheetId: 'sheet-02',
- cellData: {
- 0: {
- 0: {
- s: 1,
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- v: 2,
- m: '2',
- },
- },
- },
- defaultColumnWidth: 93,
- defaultRowHeight: 27,
- status: 0,
- };
-
- const worksheetOne = container.createInstance(Worksheet, context, sheetOneConfigure);
- workbook.insertSheet(worksheetOne);
- worksheetOne.setCommandManager(commandManager);
-
- const worksheetTwo = container.createInstance(Worksheet, context, sheetTwoConfigure);
- workbook.insertSheet(worksheetTwo);
- worksheetTwo.setCommandManager(commandManager);
-
- return { worksheetOne, worksheetTwo, workbook };
-}
-
-export function TestInitSheetInstance(worksheetConfig?: Partial<IWorksheetConfig>) {
- const configure = Object.assign(defaultWorksheetConfigure, worksheetConfig);
- const container = createCoreTestContainer();
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- return { workbook, worksheet };
-}
diff --git a/packages/core/test/Domain/Color.test.ts b/packages/core/test/Domain/Color.test.ts
deleted file mode 100644
index b6e4fc1955..0000000000
--- a/packages/core/test/Domain/Color.test.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import { ThemeColorType } from '../../src/Types/Enum';
-import { Color, RgbColor, ThemeColor } from '../../src/Sheets/Domain/Color';
-import { ColorBuilder } from '../../src/Sheets/Domain/ColorBuilder';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Test Color RgbColor', () => {
- const builder = new ColorBuilder();
- builder.setRgbColor('rgb(0,10,100)');
- const rgb = builder.build() as RgbColor;
- expect(rgb.getRed()).toEqual(0);
- expect(rgb.getGreen()).toEqual(10);
- expect(rgb.getBlue()).toEqual(100);
- expect(rgb.getAlpha()).toEqual(1);
-
- const hex = Color.rgbColorToHexValue(rgb);
- const hRgb = Color.hexValueToRgbColor(hex);
- console.log(hex);
- console.log(hRgb);
-
- builder.setRgbColor('rgba(0,10,100, 0.2)');
- const rgba = builder.build() as RgbColor;
- expect(rgba.getRed()).toEqual(0);
- expect(rgba.getGreen()).toEqual(10);
- expect(rgba.getBlue()).toEqual(100);
- expect(rgba.getAlpha()).toEqual(0.2);
-});
-
-test('Test Color themeColor Office', () => {
- const builder = new ColorBuilder();
- builder.setThemeColor(ThemeColorType.ACCENT1);
- const color = builder.build() as ThemeColor;
- const rgba = color.asRgbColor();
- expect(rgba.getRed()).toEqual(68);
- expect(rgba.getGreen()).toEqual(114);
- expect(rgba.getBlue()).toEqual(196);
- expect(rgba.getAlpha()).toEqual(1);
-});
-
-test('Test Color themeColor', () => {
- const builder = new ColorBuilder();
- builder.setThemeColor(ThemeColorType.ACCENT1);
- const color = builder.build() as ThemeColor;
- expect(color.getThemeColorType()).toEqual(ThemeColorType.ACCENT1);
-});
-
-test('Test Color RgbColor Dark', () => {
- const builder = new ColorBuilder();
- builder.setRgbColor('rgb(8,255,0)');
- const rgb = builder.build() as RgbColor;
- expect(rgb.getRed()).toEqual(8);
- expect(rgb.getGreen()).toEqual(255);
- expect(rgb.getBlue()).toEqual(0);
- expect(rgb.getAlpha()).toEqual(1);
- RgbColor.RGB_COLOR_AMT = -100;
- expect(rgb.getRed()).toEqual(0);
- expect(rgb.getGreen()).toEqual(155);
- expect(rgb.getBlue()).toEqual(0);
- expect(rgb.getAlpha()).toEqual(1);
-});
diff --git a/packages/core/test/Domain/Merges.test.ts b/packages/core/test/Domain/Merges.test.ts
deleted file mode 100644
index ada3139ba0..0000000000
--- a/packages/core/test/Domain/Merges.test.ts
+++ /dev/null
@@ -1,135 +0,0 @@
-import { Merges } from '../../src';
-import { demo } from './Range.test';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Test Merges getByRowColumn', () => {
- let { worksheet } = demo();
- const merges = new Merges(worksheet, [
- {
- startRow: 1,
- startColumn: 1,
- endRow: 5,
- endColumn: 5,
- },
- {
- startRow: 6,
- startColumn: 6,
- endRow: 10,
- endColumn: 10,
- },
- ]);
- expect(merges.getByRowColumn(2, 2)).not.toBeUndefined();
-});
-
-test('Test Merges remove', () => {
- let { worksheet } = demo();
- const merges = new Merges(worksheet, [
- {
- startRow: 1,
- startColumn: 1,
- endRow: 5,
- endColumn: 5,
- },
- {
- startRow: 6,
- startColumn: 6,
- endRow: 10,
- endColumn: 10,
- },
- ]);
- expect(
- merges.remove({
- startRow: 6,
- startColumn: 6,
- endRow: 10,
- endColumn: 10,
- }).length
- ).toEqual(1);
- expect(merges.size()).toEqual(1);
-});
-
-test('Test Merges size', () => {
- let { worksheet } = demo();
- const merges = new Merges(worksheet, [
- {
- startRow: 1,
- startColumn: 1,
- endRow: 5,
- endColumn: 5,
- },
- {
- startRow: 6,
- startColumn: 6,
- endRow: 10,
- endColumn: 10,
- },
- ]);
- expect(merges.size()).toEqual(2);
-});
-
-test('Test Merges add', () => {
- let { worksheet } = demo();
- const merges = new Merges(worksheet, [
- {
- startRow: 1,
- startColumn: 1,
- endRow: 5,
- endColumn: 5,
- },
- {
- startRow: 6,
- startColumn: 6,
- endRow: 10,
- endColumn: 10,
- },
- ]);
- expect(merges.size()).toEqual(2);
- merges.add({
- startRow: 16,
- startColumn: 16,
- endRow: 20,
- endColumn: 20,
- });
- expect(merges.size()).toEqual(3);
-});
-
-test('Test Merges union', () => {
- let { worksheet } = demo();
- const merges = new Merges(worksheet, [
- {
- startRow: 0,
- startColumn: 0,
- endRow: 5,
- endColumn: 5,
- },
- ]);
- const rect = { startRow: 0, startColumn: 0, endRow: 0, endColumn: 0 };
- expect(merges.union(rect)).toEqual(rect);
-});
-
-test('Test Merges getMergedRanges', () => {
- let { worksheet } = demo();
- const merges = new Merges(worksheet, [
- {
- startRow: 1,
- startColumn: 1,
- endRow: 5,
- endColumn: 5,
- },
- {
- startRow: 6,
- startColumn: 6,
- endRow: 10,
- endColumn: 10,
- },
- ]);
- expect(
- merges.getMergedRanges({
- startRow: 6,
- startColumn: 6,
- endRow: 10,
- endColumn: 10,
- })
- ).not.toBeUndefined();
-});
diff --git a/packages/core/test/Domain/Range.test.ts b/packages/core/test/Domain/Range.test.ts
deleted file mode 100644
index 42ee5b505c..0000000000
--- a/packages/core/test/Domain/Range.test.ts
+++ /dev/null
@@ -1,6355 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { ObjectMatrix } from '../../src';
-import { SheetContext } from '../../src/Basics/SheetContext';
-import { Workbook } from '../../src/Sheets/Domain/Workbook';
-import { Worksheet } from '../../src/Sheets/Domain/Worksheet';
-import {
- BooleanNumber,
- BorderStyleTypes,
- CopyPasteType,
- Dimension,
- Direction,
- HorizontalAlign,
- TextDirection,
- ThemeColorType,
- VerticalAlign,
- WrapStrategy,
-} from '../../src/Types/Enum';
-import { ICellData, ICellV } from '../../src/Types/Interfaces';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-// TODO performance test, 1000 times
-// TODO 修复Range单元测试报错
-// TODO 补充Range API单元格测试
-// TODO 优化:每一个测试用例都会重新初始化一个universheet实例,有的测试case是否可以合并到一个实例,减少测试执行时间
-
-/**
- *
- Tips: The test debugger with the same name will always execute. Please keep a unique name when testing, such as'Test setFontColor'
- */
-
-export function demo() {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: 1,
- v: '1',
- m: '1',
- },
- 1: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- mergeData: [
- {
- startRow: 1,
- startColumn: 1,
- endRow: 2,
- endColumn: 2,
- },
- ],
- rowCount: 30,
- columnCount: 10,
- defaultColumnWidth: 93,
- defaultRowHeight: 27,
- status: 1,
- };
- // const worksheet = new WorkSheet(context, configure);
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- configure
- );
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- return { worksheet, workbook };
-}
-
-test('Test setFontColor', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // set new color
- range.setFontColor('red');
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
- const currentColor = currentStyle && currentStyle.cl?.rgb;
-
- expect(currentColor).toEqual('red');
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous color
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- const preColor = preStyle && preStyle.cl?.rgb;
- expect(preColor).toEqual('blue');
-});
-
-test('Test setFontFamily', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- ff: 'Arial',
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- // const range = worksheet.getRangeData('B1:A10');
- const range = worksheet.getRange('A1');
-
- // set A1 fontFamily
- range.setFontFamily('Helvetica');
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- ff: 'Helvetica',
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- ff: 'Arial',
- });
-});
-
-test('Test setFontFamilies', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- ff: 'Arial',
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- // const range = worksheet.getRangeData('B1:A10');
- const range = worksheet.getRange('A1');
-
- // set A1 fontFamily
- range.setFontFamilies([['Helvetica', 'Helvetica']]);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- ff: 'Helvetica',
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- ff: 'Arial',
- });
-});
-
-test('Test setUnderline', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- ff: 'Arial',
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- // const range = worksheet.getRangeData('B1:A10');
- const range = worksheet.getRange('A1');
-
- // set A1 fontFamily
- range.setUnderline({ s: BooleanNumber.TRUE });
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- ff: 'Arial',
- ul: { s: BooleanNumber.TRUE },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- ff: 'Arial',
- });
-});
-test('Test setOverline', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- ff: 'Arial',
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- // const range = worksheet.getRangeData('B1:A10');
- const range = worksheet.getRange('A1');
-
- // set A1 fontFamily
- range.setOverline({ s: BooleanNumber.TRUE });
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- ff: 'Arial',
- ol: { s: BooleanNumber.TRUE },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- ff: 'Arial',
- });
-});
-test('Test setStrikeThrough', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- ff: 'Arial',
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- // const range = worksheet.getRangeData('B1:A10');
- const range = worksheet.getRange('A1');
-
- // set A1 fontFamily
- range.setStrikeThrough({ s: BooleanNumber.TRUE });
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- ff: 'Arial',
- st: { s: BooleanNumber.TRUE },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- ff: 'Arial',
- });
-});
-test('Test setFontSize', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- ff: 'Arial',
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // set A1 fontSize
- range.setFontSize(18);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- ff: 'Arial',
- fs: 18,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- ff: 'Arial',
- fs: 12,
- });
-});
-
-test('Test setHorizontalAlignment', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- ht: HorizontalAlign.CENTER,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // set A1 horizontalAlignment
- range.setHorizontalAlignment(HorizontalAlign.LEFT);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- ht: HorizontalAlign.LEFT,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- ht: HorizontalAlign.CENTER,
- });
-});
-
-test('Test setVerticalAlignment', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- vt: VerticalAlign.MIDDLE,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // set A1 verticalAlignment
- range.setVerticalAlignment(VerticalAlign.TOP);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- vt: VerticalAlign.TOP,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- vt: VerticalAlign.MIDDLE,
- });
-});
-
-test('Test setTextDirection', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- td: TextDirection.LEFT_TO_RIGHT,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // set A1 textDirection
- range.setTextDirection(TextDirection.RIGHT_TO_LEFT);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- td: TextDirection.RIGHT_TO_LEFT,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- td: TextDirection.LEFT_TO_RIGHT,
- });
-});
-
-test('Test setWrapStrategy', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // set A1 wrapStrategy
- range.setWrapStrategy(WrapStrategy.OVERFLOW);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- tb: WrapStrategy.OVERFLOW,
- });
-
- // set A1 wrapStrategy
- range.setWrapStrategy(WrapStrategy.WRAP);
-
- const nextCell = worksheet.getCellMatrix().getValue(0, 0);
- const nextStyle = workbook.getStyles().get(nextCell && nextCell.s);
-
- expect(nextStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- tb: WrapStrategy.WRAP,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- tb: WrapStrategy.OVERFLOW,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test init style
- const initValue = worksheet.getCellMatrix().getValue(0, 0);
- const initStyle = workbook.getStyles().get(initValue && initValue.s);
- expect(initStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- });
-});
-
-test('Test setWrapStrategies', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 wrapStrategy
- range.setWrapStrategies([[WrapStrategy.WRAP, WrapStrategy.WRAP]]);
-
- const nextCell = worksheet.getCellMatrix().getValue(0, 0);
- const nextStyle = workbook.getStyles().get(nextCell && nextCell.s);
-
- expect(nextStyle).toEqual({
- fs: 12,
- tb: WrapStrategy.WRAP,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- fs: 12,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test init style
- const initValue = worksheet.getCellMatrix().getValue(0, 0);
- const initStyle = workbook.getStyles().get(initValue && initValue.s);
- expect(initStyle).toEqual({
- fs: 12,
- });
-});
-
-test('Test setBorder', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bd: {
- l: {
- s: BorderStyleTypes.DOTTED,
- cl: {
- th: ThemeColorType.DARK1,
- },
- },
- b: {
- s: BorderStyleTypes.DOTTED,
- cl: {
- th: ThemeColorType.DARK1,
- },
- },
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
-
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- configure
- );
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // set border
- range.setBorder(
- true,
- true,
- true,
- true,
- false,
- false,
- 'red',
- BorderStyleTypes.DASH_DOT
- );
- // dashDot
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bd: {
- t: {
- s: BorderStyleTypes.DASH_DOT,
- cl: {
- rgb: 'red',
- },
- },
- b: {
- s: BorderStyleTypes.DASH_DOT,
- cl: {
- rgb: 'red',
- },
- },
- l: {
- s: BorderStyleTypes.DASH_DOT,
- cl: {
- rgb: 'red',
- },
- },
- r: {
- s: BorderStyleTypes.DASH_DOT,
- cl: {
- rgb: 'red',
- },
- },
- },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test init style
- const initValue = worksheet.getCellMatrix().getValue(0, 0);
- const initStyle = workbook.getStyles().get(initValue && initValue.s);
- expect(initStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bd: {
- l: {
- s: BorderStyleTypes.DOTTED,
- cl: {
- th: ThemeColorType.DARK1,
- },
- },
- b: {
- s: BorderStyleTypes.DOTTED,
- cl: {
- th: ThemeColorType.DARK1,
- },
- },
- },
- });
-
- worksheet.getCommandManager().redo();
- const redoCell = worksheet.getCellMatrix().getValue(0, 0);
- const redoStyle = workbook.getStyles().get(redoCell && redoCell.s);
-
- expect(redoStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bd: {
- t: {
- s: BorderStyleTypes.DASH_DOT,
- cl: {
- rgb: 'red',
- },
- },
- b: {
- s: BorderStyleTypes.DASH_DOT,
- cl: {
- rgb: 'red',
- },
- },
- l: {
- s: BorderStyleTypes.DASH_DOT,
- cl: {
- rgb: 'red',
- },
- },
- r: {
- s: BorderStyleTypes.DASH_DOT,
- cl: {
- rgb: 'red',
- },
- },
- },
- });
-});
-
-test('Test copyTo formatOnly', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // copy A1 to B1:D3
- range.copyTo(worksheet.getRange('B1:D3'), { formatOnly: true });
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 1);
-
- expect(currentCell).toEqual({ s: 1, v: 1, m: '1' });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous
- const preCell = worksheet.getCellMatrix().getValue(0, 1);
- expect(preCell).toEqual({ v: 2, m: '2' });
-});
-
-test('Test copyTo contentsOnly', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // copy A1 style to B1:D3
- range.copyTo(worksheet.getRange('B1:D3'), { contentsOnly: true });
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 1);
-
- expect(currentCell).toEqual({
- v: 1,
- s: 1,
- m: '1',
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = worksheet.getCellMatrix().getValue(0, 1);
-
- expect(preCell).toEqual({
- v: 2,
- m: '2',
- });
-
- // redo
- worksheet.getCommandManager().redo();
-
- // test next value
- const nextCell = worksheet.getCellMatrix().getValue(0, 1);
- expect(nextCell).toEqual({
- v: 1,
- s: 1,
- m: '1',
- });
-});
-
-test('Test copyTo CopyPasteType', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- columnData: {
- 0: {
- w: 30,
- hd: 1,
- },
- 1: {
- w: 50,
- hd: 1,
- },
- },
-
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:A3');
-
- const destination = worksheet.getRange('B1:B3');
-
- // copy A1 style to B1:B3
- range.copyTo(destination, CopyPasteType.PASTE_COLUMN_WIDTHS, false);
-
- const width = worksheet.getColumnWidth(0);
-
- expect(width).toEqual(30);
-});
-
-test('Test copyFormatToRange by sheet', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // copy A1 style to B1:D3
- range.copyFormatToRange(worksheet, 0, 2, 1, 3);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 1);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 1);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- cl: {
- rgb: 'green',
- },
- fs: 14,
- });
-});
-test('Test copyFormatToRange by sheetId', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // copy A1 style to B1:D3
- range.copyFormatToRange(worksheet.getSheetId(), 0, 2, 1, 3);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 1);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 1);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- cl: {
- rgb: 'green',
- },
- fs: 14,
- });
-});
-
-test('Test copyValuesToRange by sheet', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // copy A1 values to B2:C3
- range.copyValuesToRange(worksheet, 1, 2, 1, 2);
-
- const currentCell = worksheet.getCellMatrix().getFragments(1, 2, 1, 2).getData();
-
- expect(currentCell).toEqual({
- 0: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- },
- 1: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous B2:C3 values
- const preCell = worksheet.getCellMatrix().getFragments(1, 2, 1, 2).getData();
- expect(preCell).toEqual({
- 0: {
- 0: { m: '', v: '' },
- 1: { m: '', v: '' },
- },
- 1: {
- 0: { m: '', v: '' },
- 1: { m: '', v: '' },
- },
- });
-});
-
-test('Test copyValuesToRange by sheetId', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // copy A1 values to B2:C3
- range.copyValuesToRange(worksheet.getSheetId(), 1, 2, 1, 2);
-
- const currentCell = worksheet.getCellMatrix().getFragments(1, 2, 1, 2).getData();
-
- expect(currentCell).toEqual({
- 0: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- },
- 1: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous B2:C3 values
- const preCell = worksheet.getCellMatrix().getFragments(1, 2, 1, 2).getData();
- expect(preCell).toEqual({
- 0: {
- 0: { m: '', v: '' },
- 1: { m: '', v: '' },
- },
- 1: {
- 0: { m: '', v: '' },
- 1: { m: '', v: '' },
- },
- });
-});
-test('Test moveTo', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeA = worksheet.getRange('A1:B1');
- const rangeB = worksheet.getRange('A2:B2');
-
- // copy A1:B1 move to A2:B2
- rangeA.moveTo(rangeB);
-
- // current A2:B2 values
- const currentAValue = rangeA.getObjectValues();
- const currentBValue = rangeB.getObjectValues({ isIncludeStyle: true });
-
- expect(currentAValue).toEqual({
- 0: {
- 0: { m: '', v: '' },
- 1: { m: '', v: '' },
- },
- });
- expect(currentBValue).toEqual({
- 0: {
- 0: {
- s: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- v: 1,
- m: '1',
- },
- 1: {
- s: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- },
- v: 2,
- m: '2',
- },
- },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // previous A2:B2 values
- const preAValue = rangeA.getObjectValues();
- const preBValue = rangeB.getObjectValues();
-
- expect(preAValue).toEqual({
- 0: {
- 0: {
- s: 1,
- v: 1,
- m: '1',
- },
- 1: {
- s: 2,
- v: 2,
- m: '2',
- },
- },
- });
-
- expect(preBValue).toEqual({
- 0: {
- 0: {},
- 1: {},
- },
- });
-
- // redo
- worksheet.getCommandManager().redo();
-
- // next A2:B2 values
- const nextAValue = rangeA.getObjectValues();
- const nextBValue = rangeB.getObjectValues();
-
- expect(nextAValue).toEqual({
- 0: {
- 0: { m: '', v: '' },
- 1: { m: '', v: '' },
- },
- });
- expect(nextBValue).toEqual({
- 0: {
- 0: {
- s: 1,
- v: 1,
- m: '1',
- },
- 1: {
- s: 2,
- v: 2,
- m: '2',
- },
- },
- });
-});
-test('Test offset', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeA = worksheet.getRange('A1');
-
- // A1 offset to B2:C3
- const rangeB = rangeA.offset(1, 1, 2, 2);
-
- expect(rangeB.getRangeData()).toEqual({
- startRow: 1,
- endRow: 2,
- startColumn: 1,
- endColumn: 2,
- });
-});
-
-test('Test setValue', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // set new value
- range.setValue(3);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
-
- expect(currentCell).toEqual({ s: 1, v: 3, m: '3' });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- expect(preCell).toEqual({ s: 1, v: 1, m: '1' });
-});
-
-test('Test setValues ICellV', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // set new value
- range.setValues([[5, 6]]);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
-
- expect(currentCell).toEqual({ s: 1, v: 5, m: '5' });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- expect(preCell).toEqual({ s: 1, v: 1, m: '1' });
-});
-
-test('Test setValues ObjectMatrix', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- const matrix = new ObjectMatrix<ICellV>();
-
- matrix.setValue(0, 0, 5);
- matrix.setValue(0, 1, 6);
-
- // set new value
- range.setValues(matrix);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
-
- expect(currentCell).toEqual({ s: 1, v: 5, m: '5' });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- expect(preCell).toEqual({ s: 1, v: 1, m: '1' });
-});
-
-test('Test clear', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // clear
- range.clear({ formatOnly: true, contentsOnly: true });
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- expect(currentCell && currentCell.s).toEqual(undefined);
- expect(currentCell && currentCell.v).toEqual('');
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test init style
- const initValue = worksheet.getCellMatrix().getValue(0, 0);
- const initStyle = workbook.getStyles().get(initValue && initValue.s);
- expect(initStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- });
-
- expect(initValue && initValue.v).toEqual(1);
-});
-test('Test clearFormat', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // clear style
- range.clearFormat();
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- expect(currentCell && currentCell.s).toEqual(undefined);
- expect(currentCell && currentCell.v).toEqual(1);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test init style
- const initValue = worksheet.getCellMatrix().getValue(0, 0);
- const initStyle = workbook.getStyles().get(initValue && initValue.s);
- expect(initStyle).toEqual({
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- });
-
- expect(initValue && initValue.v).toEqual(1);
-});
-test('Test deleteCells', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- 2: {
- v: 8,
- m: '8',
- },
- 3: {
- v: 8,
- m: '8',
- },
- },
- 1: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- 2: {
- v: 8,
- m: '8',
- },
- 3: {
- v: 8,
- m: '8',
- },
- },
- 2: {
- 0: {
- v: 1111,
- m: '1111',
- },
- 1: {
- v: 1111,
- m: '1111',
- },
- },
- 3: {
- 0: {
- v: 1111,
- m: '1111',
- },
- 1: {
- v: 1111,
- m: '1111',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B2');
-
- // Delete cells and shift up
- range.deleteCells(Dimension.ROWS);
-
- // test current A1:B4 values
- const currentCells = worksheet.getRange('A1:B4').getValues();
-
- expect(currentCells).toEqual([
- [
- { v: 1111, m: '1111' },
- { v: 1111, m: '1111' },
- ],
- [
- { v: 1111, m: '1111' },
- { v: 1111, m: '1111' },
- ],
- [{}, {}],
- [{}, {}],
- ]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous A1:B4 value
- const preCells = worksheet.getRange('A1:B4').getValues();
-
- expect(preCells).toEqual([
- [
- { v: 1, m: '1' },
- { v: 1, m: '1' },
- ],
- [
- { v: 1, m: '1' },
- { v: 1, m: '1' },
- ],
- [
- { v: 1111, m: '1111' },
- { v: 1111, m: '1111' },
- ],
- [
- { v: 1111, m: '1111' },
- { v: 1111, m: '1111' },
- ],
- ]);
- // redo
- worksheet.getCommandManager().redo();
-
- // test next A1:B4 value
- const nextCells = worksheet.getRange('A1:B4').getValues();
- expect(nextCells).toEqual([
- [
- { v: 1111, m: '1111' },
- { v: 1111, m: '1111' },
- ],
- [
- { v: 1111, m: '1111' },
- { v: 1111, m: '1111' },
- ],
- [{}, {}],
- [{}, {}],
- ]);
-});
-
-test('Test insertCells', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- 2: {
- v: 8,
- m: '8',
- },
- 3: {
- v: 8,
- m: '8',
- },
- },
- 1: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- 2: {
- v: 8,
- m: '8',
- },
- 3: {
- v: 8,
- m: '8',
- },
- },
- 2: {
- 0: {
- v: 1111,
- m: '1111',
- },
- 1: {
- v: 1111,
- m: '1111',
- },
- },
- 3: {
- 0: {
- v: 1111,
- m: '1111',
- },
- 1: {
- v: 1111,
- m: '1111',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B2');
-
- // insert blank cells and shift down
- range.insertCells(Dimension.ROWS);
-
- // test current A1:B4 values
- const currentCells = worksheet.getRange('A1:B4').getValues();
-
- expect(currentCells).toEqual([
- [
- { v: '', m: '' },
- { v: '', m: '' },
- ],
- [
- { v: '', m: '' },
- { v: '', m: '' },
- ],
- [
- { v: 1, m: '1' },
- { v: 1, m: '1' },
- ],
- [
- { v: 1, m: '1' },
- { v: 1, m: '1' },
- ],
- ]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous A1:B4 value
- const preCells = worksheet.getRange('A1:B4').getValues();
-
- expect(preCells).toEqual([
- [
- { v: 1, m: '1' },
- { v: 1, m: '1' },
- ],
- [
- { v: 1, m: '1' },
- { v: 1, m: '1' },
- ],
- [
- { v: 1111, m: '1111' },
- { v: 1111, m: '1111' },
- ],
- [
- { v: 1111, m: '1111' },
- { v: 1111, m: '1111' },
- ],
- ]);
- // redo
- worksheet.getCommandManager().redo();
-
- // test next A1:B4 value
- const nextCells = worksheet.getRange('A1:B4').getValues();
-
- expect(nextCells).toEqual([
- [
- { v: '', m: '' },
- { v: '', m: '' },
- ],
- [
- { v: '', m: '' },
- { v: '', m: '' },
- ],
- [
- { v: 1, m: '1' },
- { v: 1, m: '1' },
- ],
- [
- { v: 1, m: '1' },
- { v: 1, m: '1' },
- ],
- ]);
-});
-
-test('Test insertCells COLUMNS', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- },
- 1: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- },
- 2: {
- 0: {
- v: 1111,
- m: '1111',
- },
- 1: {
- v: 1111,
- m: '1111',
- },
- },
- 3: {
- 0: {
- v: 1111,
- m: '1111',
- },
- 1: {
- v: 1111,
- m: '1111',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B2');
- const destination = worksheet.getRange('A3:B4');
-
- range.insertCells(Dimension.COLUMNS, destination);
- const columnCells = worksheet.getRange('A1:D2').getValues();
-
- expect(columnCells).toEqual([
- [
- { v: 1111, m: '1111' },
- { v: 1111, m: '1111' },
- { v: 1, m: '1' },
- { v: 1, m: '1' },
- ],
- [
- { v: 1111, m: '1111' },
- { v: 1111, m: '1111' },
- { v: 1, m: '1' },
- { v: 1, m: '1' },
- ],
- ]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous A1:B4 value
- const preCells = worksheet.getRange('A1:D2').getValues();
-
- expect(preCells).toEqual([
- [{ v: 1, m: '1' }, { v: 1, m: '1' }, {}, {}],
- [{ v: 1, m: '1' }, { v: 1, m: '1' }, {}, {}],
- ]);
-});
-
-test('Create a Merge', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- 2: {
- v: 8,
- m: '8',
- },
- 3: {
- v: 8,
- m: '8',
- },
- },
- 1: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- 2: {
- v: 8,
- m: '8',
- },
- 3: {
- v: 8,
- m: '8',
- },
- },
- 2: {
- 0: {
- v: 1111,
- m: '1111',
- },
- 1: {
- v: 1111,
- m: '1111',
- },
- },
- 3: {
- 0: {
- v: 1111,
- m: '1111',
- },
- 1: {
- v: 1111,
- m: '1111',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B2');
-
- // merge range
- range.merge();
-
- // test current A1:B4 values
- const merges = worksheet.getMerges();
- expect(merges.size() === 1);
-});
-
-test('Test getBackground', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bg: {
- rgb: '#ff0000',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- 2: {
- v: 8,
- m: '8',
- },
- 3: {
- v: 8,
- m: '8',
- },
- },
- 1: {
- 0: {
- v: 1,
- m: '1',
- },
- 1: {
- v: 1,
- m: '1',
- },
- 2: {
- v: 8,
- m: '8',
- },
- 3: {
- v: 8,
- m: '8',
- },
- },
- 2: {
- 0: {
- v: 1111,
- m: '1111',
- },
- 1: {
- v: 1111,
- m: '1111',
- },
- },
- 3: {
- 0: {
- v: 1111,
- m: '1111',
- },
- 1: {
- v: 1111,
- m: '1111',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // get A1 background
- const background = range.getBackground();
-
- expect(background).toEqual('#ff0000');
-});
-test('Test getBackgrounds', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 backgrounds
- const backgrounds = range.getBackgrounds();
-
- expect(backgrounds).toEqual([['#ff0000', '#0000ff']]);
-});
-
-test('Test getCell', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get B1 Range instance
- const cellValue = range.getCell(0, 1).getValue()?.m;
-
- expect(cellValue).toEqual('2');
-});
-
-test('Test getColumn', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get the starting column position for this range.
- const columnNumber = range.getColumn();
-
- expect(columnNumber).toEqual(0);
-});
-
-test('Test getDisplayValue', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get the displayed value of the top-left cell in the range
- const cellValue = range.getDisplayValue();
-
- expect(cellValue).toEqual('1');
-});
-
-test('Test getDisplayValues', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get the rectangular grid of values for this range.
- const cellValue = range.getDisplayValues();
-
- expect(cellValue).toEqual([['1', '2']]);
-});
-
-test('Test getFontColor', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 backgrounds
- const backgrounds = range.getFontColor();
-
- expect(backgrounds).toEqual('blue');
-});
-
-test('Test getFontColors', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 backgrounds
- const backgrounds = range.getFontColors();
-
- expect(backgrounds).toEqual([['blue', 'green']]);
-});
-
-test('Test getFontFamily', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- ff: '微软雅黑',
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- ff: 'Roboto',
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 backgrounds
- const backgrounds = range.getFontFamily();
-
- expect(backgrounds).toEqual('微软雅黑');
-});
-
-test('Test getFontFamilies', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- ff: '微软雅黑',
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- ff: 'Roboto',
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 backgrounds
- const backgrounds = range.getFontFamilies();
-
- expect(backgrounds).toEqual([['微软雅黑', 'Roboto']]);
-});
-
-test('Test getFontLines', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- ul: { s: BooleanNumber.TRUE },
- ol: { s: BooleanNumber.TRUE },
- st: { s: BooleanNumber.TRUE },
- },
- 2: {
- ul: { s: BooleanNumber.TRUE },
- ol: { s: BooleanNumber.TRUE },
- st: { s: BooleanNumber.TRUE },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 FontLines
- const underlines = range.getUnderlines();
- const overline = range.getOverlines();
- const strikethroughs = range.getStrikeThroughs();
-
- expect(underlines).toEqual([
- [{ s: BooleanNumber.TRUE }, { s: BooleanNumber.TRUE }],
- ]);
- expect(overline).toEqual([
- [{ s: BooleanNumber.TRUE }, { s: BooleanNumber.TRUE }],
- ]);
- expect(strikethroughs).toEqual([
- [{ s: BooleanNumber.TRUE }, { s: BooleanNumber.TRUE }],
- ]);
-});
-
-test('Test getFontLine', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- ul: { s: BooleanNumber.TRUE },
- ol: { s: BooleanNumber.TRUE },
- st: { s: BooleanNumber.TRUE },
- },
- 2: {
- ul: { s: BooleanNumber.TRUE },
- ol: { s: BooleanNumber.TRUE },
- st: { s: BooleanNumber.TRUE },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // get A1 getFontLine
- const underlines = range.getUnderline();
- const overline = range.getOverline();
- const strikethroughs = range.getStrikeThrough();
-
- expect(underlines).toEqual({ s: BooleanNumber.TRUE });
- expect(overline).toEqual({ s: BooleanNumber.TRUE });
- expect(strikethroughs).toEqual({ s: BooleanNumber.TRUE });
-});
-
-test('Test getFontSize', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- ff: '微软雅黑',
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- ff: 'Roboto',
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 backgrounds
- const backgrounds = range.getFontSize();
-
- expect(backgrounds).toEqual(12);
-});
-
-test('Test getFontSizes', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- ff: '微软雅黑',
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- ff: 'Roboto',
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 getFontSizes
- const fs = range.getFontSizes();
-
- expect(fs).toEqual([[12, 14]]);
-});
-
-test('Test getFontWeight', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- bl: 1,
- },
- 2: {
- bl: 0,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // get A1:B1 getFontWeights
- const A1 = range.getFontWeight();
-
- expect(A1).toEqual(1);
-
- const range2 = worksheet.getRange('B1');
-
- // get A1:B1 getFontWeight
- const B1 = range2.getFontWeight();
-
- expect(B1).toEqual(0);
-});
-test('Test getFontWeights', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- bl: 1,
- ff: '微软雅黑',
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- bl: 0,
- ff: 'Roboto',
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 getFontWeights
- const A1 = range.getFontWeights();
-
- expect(A1).toEqual([[1, 0]]);
-});
-
-test('Test getHorizontalAlignment', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- ht: HorizontalAlign.LEFT,
- },
- 2: {
- ht: HorizontalAlign.CENTER,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // get A1:B1 getHorizontalAlignments
- const A1 = range.getHorizontalAlignment();
-
- expect(A1).toEqual(HorizontalAlign.LEFT);
-});
-
-test('Test getHorizontalAlignments', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- ht: HorizontalAlign.LEFT,
- },
- 2: {
- ht: HorizontalAlign.CENTER,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 getHorizontalAlignments
- const A1 = range.getHorizontalAlignments();
-
- expect(A1).toEqual([[HorizontalAlign.LEFT, HorizontalAlign.CENTER]]);
-});
-
-test('Test getVerticalAlignments', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- vt: VerticalAlign.TOP,
- },
- 2: {
- vt: VerticalAlign.MIDDLE,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 getVerticalAlignments
- const A1 = range.getVerticalAlignments();
-
- expect(A1).toEqual([[VerticalAlign.TOP, VerticalAlign.MIDDLE]]);
-});
-
-test('Test getVerticalAlignment', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- vt: VerticalAlign.TOP,
- },
- 2: {
- vt: VerticalAlign.MIDDLE,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 getVerticalAlignments
- const A1 = range.getVerticalAlignment();
-
- expect(A1).toEqual(VerticalAlign.TOP);
-});
-
-test('Test getFontStyles', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- it: 1,
- },
- 2: {
- it: 0,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 getFontStyles
- const A1 = range.getFontStyles();
-
- expect(A1).toEqual([[1, 0]]);
-});
-
-test('Test getFontStyle', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- it: 1,
- },
- 2: {
- it: 0,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 getFontStyles
- const A1 = range.getFontStyle();
-
- expect(A1).toEqual(1);
-});
-
-test('Test getTextDirections', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- td: 1,
- },
- 2: {
- td: 2,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 getTextDirections
- const A1 = range.getTextDirections();
-
- expect(A1).toEqual([[1, 2]]);
-});
-
-test('Test getTextDirection', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- td: 1,
- },
- 2: {
- td: 2,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // get A1 getTextDirection
- const A1 = range.getTextDirection();
-
- expect(A1).toEqual(1);
-});
-
-test('Test getTextRotations', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- tr: {
- a: 90,
- },
- },
- 2: {
- tr: {
- a: -90,
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1 getTextRotations
- const A1 = range.getTextRotations();
-
- expect(A1).toEqual([
- [
- {
- a: 90,
- },
- {
- a: -90,
- },
- ],
- ]);
-});
-
-test('Test getTextRotation', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- tr: {
- a: 90,
- },
- },
- 2: {
- tr: {
- a: -90,
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // get A1 getTextRotation
- const A1 = range.getTextRotation();
-
- expect(A1).toEqual({ a: 90 });
-});
-
-test('Test getTextStyles', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- ff: '微软雅黑',
- },
- 2: {
- fs: 14,
- ff: '宋体',
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1 getTextStyles
- const A1 = range.getTextStyles();
-
- expect(A1).toEqual([
- [
- {
- fs: 12,
- ff: '微软雅黑',
- },
- {
- fs: 14,
- ff: '宋体',
- },
- ],
- ]);
-});
-
-test('Test getTextStyle', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- ff: '微软雅黑',
- },
- 2: {
- fs: 14,
- ff: '宋体',
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1 getTextStyle
- const A1 = range.getTextStyle();
-
- expect(A1).toEqual({
- fs: 12,
- ff: '微软雅黑',
- });
-});
-
-test('Test getSheet', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- ff: '微软雅黑',
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- ff: 'Roboto',
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // get A1:B1 sheetId
- const sheetId = range.getSheet().getSheetId();
-
- expect(sheetId).toEqual('sheet');
-});
-
-test('Test getNumColumns', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- ff: '微软雅黑',
- bg: {
- rgb: '#ff0000',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:C1');
-
- // get A1:B1 sheetId
- const column = range.getNumColumns();
-
- expect(column).toEqual(3);
-});
-
-test('Test getNumRows', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- ff: '微软雅黑',
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- ff: 'Roboto',
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B5');
-
- // get A1:B1 sheetId
- const rows = range.getNumRows();
-
- expect(rows).toEqual(5);
-});
-
-test('Test getRowIndex', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- ff: '微软雅黑',
- bg: {
- rgb: '#ff0000',
- },
- },
- 2: {
- cl: {
- rgb: 'green',
- },
- fs: 14,
- ff: 'Roboto',
- bg: {
- rgb: '#0000ff',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A5');
-
- // get A1:B1 sheetId
- const row = range.getRowIndex();
-
- expect(row).toEqual(4);
-});
-
-test('Test getLastColumn', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- ff: '微软雅黑',
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('C5');
-
- // get LastColumn
- const LastColumn = range.getLastColumn();
-
- expect(LastColumn).toEqual(2);
-});
-
-test('Test getWrapStrategies', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- tb: WrapStrategy.OVERFLOW,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- const wrapStrategies = range.getWrapStrategies();
- expect(wrapStrategies).toEqual([[1, 1]]);
-
- const wrapStrategy = range.getWrapStrategy();
- expect(wrapStrategy).toEqual(1);
-});
-
-test('Test getWraps/getWrap', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- tb: WrapStrategy.OVERFLOW,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
- // get LastColumn
- const wraps = range.getWraps();
- expect(wraps).toEqual([[1, 1]]);
-
- const wrap = range.getWrap();
- expect(wrap).toEqual(1);
-});
-
-test('Test setFontColors', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '2',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // set new color
- range.setFontColors([['green', 'yellow']]);
-
- const currentCell1 = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle1 = workbook.getStyles().get(currentCell1 && currentCell1.s);
- const currentColor1 = currentStyle1 && currentStyle1.cl?.rgb;
-
- expect(currentColor1).toEqual('green');
-
- const currentCell2 = worksheet.getCellMatrix().getValue(0, 1);
- const currentStyle2 = workbook.getStyles().get(currentCell2 && currentCell2.s);
- const currentColor2 = currentStyle2 && currentStyle2.cl?.rgb;
-
- expect(currentColor2).toEqual('yellow');
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous color
- const preCell1 = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle1 = workbook.getStyles().get(preCell1 && preCell1.s);
- const preColor1 = preStyle1 && preStyle1.cl?.rgb;
- expect(preColor1).toEqual('blue');
-
- const preCell2 = worksheet.getCellMatrix().getValue(0, 1);
- const preStyle2 = workbook.getStyles().get(preCell2 && preCell2.s);
- const preColor2 = preStyle2 && preStyle2.cl?.rgb;
- expect(preColor2).toEqual('red');
-});
-
-test('Test setBackground', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- bg: {
- rgb: 'blue',
- },
- ff: 'Arial',
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- // set A1 fontSize
- range.setBackground('red');
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- bg: {
- rgb: 'red',
- },
- ff: 'Arial',
- fs: 12,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- bg: {
- rgb: 'blue',
- },
- ff: 'Arial',
- fs: 12,
- });
- // redo
- worksheet.getCommandManager().redo();
-
- // test next style
- const nextCell = worksheet.getCellMatrix().getValue(0, 0);
- const nextStyle = workbook.getStyles().get(nextCell && nextCell.s);
- expect(nextStyle).toEqual({
- bg: {
- rgb: 'red',
- },
- ff: 'Arial',
- fs: 12,
- });
-});
-
-test('Test setBackgrounds', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- bg: {
- rgb: 'blue',
- },
- ff: 'Arial',
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 fontSize
- range.setBackgrounds([['red', 'green']]);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 1);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- bg: {
- rgb: 'green',
- },
- ff: 'Arial',
- fs: 12,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 1);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- bg: {
- rgb: 'blue',
- },
- ff: 'Arial',
- fs: 12,
- });
- // redo
- worksheet.getCommandManager().redo();
-
- // test next style
- const nextCell = worksheet.getCellMatrix().getValue(0, 1);
- const nextStyle = workbook.getStyles().get(nextCell && nextCell.s);
- expect(nextStyle).toEqual({
- bg: {
- rgb: 'green',
- },
- ff: 'Arial',
- fs: 12,
- });
-});
-
-test('Test setBackgroundRGB', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- bg: {
- rgb: 'blue',
- },
- ff: 'Arial',
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 fontSize
- range.setBackgroundRGB(0, 0, 0);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- bg: {
- rgb: 'RGB(0,0,0)',
- },
- ff: 'Arial',
- fs: 12,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- bg: {
- rgb: 'blue',
- },
- ff: 'Arial',
- fs: 12,
- });
- // redo
- worksheet.getCommandManager().redo();
-
- // test next style
- const nextCell = worksheet.getCellMatrix().getValue(0, 0);
- const nextStyle = workbook.getStyles().get(nextCell && nextCell.s);
- expect(nextStyle).toEqual({
- bg: {
- rgb: 'RGB(0,0,0)',
- },
- ff: 'Arial',
- fs: 12,
- });
-});
-
-test('Test setUnderline', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 fontSize
- range.setUnderlines([[{ s: BooleanNumber.TRUE }]]);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- fs: 12,
- ul: { s: BooleanNumber.TRUE },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- fs: 12,
- });
-});
-
-test('Test setOverline', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 fontSize
- range.setOverlines([[{ s: BooleanNumber.TRUE }]]);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- fs: 12,
- ol: { s: BooleanNumber.TRUE },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- fs: 12,
- });
-});
-
-test('Test setStrikeThrough', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 fontSize
- range.setStrikeThroughs([[{ s: BooleanNumber.TRUE }]]);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
- const currentStyle = workbook.getStyles().get(currentCell && currentCell.s);
-
- expect(currentStyle).toEqual({
- fs: 12,
- st: { s: BooleanNumber.TRUE },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- fs: 12,
- });
-});
-
-test('Test setHorizontalAlignments', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 setHorizontalAlignments
- range.setHorizontalAlignments([[HorizontalAlign.CENTER, HorizontalAlign.LEFT]]);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- const B1 = worksheet.getCellMatrix().getValue(0, 1);
- const B1Style = workbook.getStyles().get(B1 && B1.s);
-
- expect(A1Style).toEqual({
- fs: 12,
- ht: HorizontalAlign.CENTER,
- });
-
- expect(B1Style).toEqual({
- ht: HorizontalAlign.LEFT,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- const preStyle = workbook.getStyles().get(preCell && preCell.s);
- expect(preStyle).toEqual({
- fs: 12,
- });
-
- /**
- * TODO :优化数据
- * 撤销后B1单元格为空
- * cellData: {
- * 0: {
- * 0: {
- * s: 1,
- * v: 1,
- * m: '1',
- * },
- * 1: {}
- * },
- * },
- */
- const preB1 = worksheet.getCellMatrix().getValue(0, 1);
- expect(preB1).toEqual({});
-});
-
-test('Test isPartOfMerge', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- mergeData: [
- {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 1,
- },
- ],
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 1,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeA = worksheet.getRange('A1:C3');
-
- const isMergeA = rangeA.isPartOfMerge();
-
- expect(isMergeA).toEqual(true);
-
- const rangeB = worksheet.getRange('A4:C6');
-
- const isMergeB = rangeB.isPartOfMerge();
-
- expect(isMergeB).toEqual(false);
-});
-
-test('Test getLastRow', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:C5');
-
- const lastRow = range.getLastRow();
-
- expect(lastRow).toEqual(4);
-});
-
-test('Test setFontSizes', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 setFontSizes
- range.setFontSizes([[16, 18]]);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- const B1 = worksheet.getCellMatrix().getValue(0, 1);
- const B1Style = workbook.getStyles().get(B1 && B1.s);
-
- expect(A1Style).toEqual({
- fs: 16,
- });
-
- expect(B1Style).toEqual({
- fs: 18,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-});
-
-test('Test setTextDirections', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 setTextDirections
- range.setTextDirections([[0, 1]]);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- const B1 = worksheet.getCellMatrix().getValue(0, 1);
- const B1Style = workbook.getStyles().get(B1 && B1.s);
-
- expect(A1Style).toEqual({
- fs: 12,
- td: 0,
- });
-
- expect(B1Style).toEqual({
- fs: 12,
- td: 1,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-});
-
-test('Test setFontWeights', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 setFontWeights
- range.setFontWeights([[0, 1]]);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- const B1 = worksheet.getCellMatrix().getValue(0, 1);
- const B1Style = workbook.getStyles().get(B1 && B1.s);
-
- expect(A1Style).toEqual({
- fs: 12,
- bl: 0,
- });
-
- expect(B1Style).toEqual({
- fs: 12,
- bl: 1,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-});
-
-test('Test setFontWeight', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1');
-
- // set A1 setFontWeights
- range.setFontWeight(1);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- expect(A1Style).toEqual({
- fs: 12,
- bl: 1,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-});
-
-test('Test setFontStyles', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 setFontStyles
- range.setFontStyles([[0, 1]]);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- expect(A1Style).toEqual({
- fs: 12,
- it: 0,
- });
-
- const B1 = worksheet.getCellMatrix().getValue(0, 1);
- const B1Style = workbook.getStyles().get(B1 && B1.s);
-
- expect(B1Style).toEqual({
- fs: 12,
- it: 1,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
- const preB1 = worksheet.getCellMatrix().getValue(0, 1);
- const preB1Style = workbook.getStyles().get(preB1 && preB1.s);
- expect(preB1Style).toEqual({
- fs: 12,
- });
-});
-test('Test setFontStyle', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1');
-
- // set A1 setFontStyles
- range.setFontStyle(1);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- expect(A1Style).toEqual({
- fs: 12,
- it: 1,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-});
-test('Test setVerticalAlignments', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 setVerticalAlignments
- range.setVerticalAlignments([[0, 1]]);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- expect(A1Style).toEqual({
- fs: 12,
- vt: 0,
- });
- const B1 = worksheet.getCellMatrix().getValue(0, 1);
- const B1Style = workbook.getStyles().get(B1 && B1.s);
-
- expect(B1Style).toEqual({
- fs: 12,
- vt: 1,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-
- const preB1 = worksheet.getCellMatrix().getValue(0, 0);
- const preB1Style = workbook.getStyles().get(preB1 && preB1.s);
- expect(preB1Style).toEqual({
- fs: 12,
- });
-});
-
-test('Test setTextRotations', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 setTextRotations
- range.setTextRotations([[0, 1]]);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- const B1 = worksheet.getCellMatrix().getValue(0, 1);
- const B1Style = workbook.getStyles().get(B1 && B1.s);
-
- expect(A1Style).toEqual({
- fs: 12,
- tr: { v: 0, a: 0 },
- });
-
- expect(B1Style).toEqual({
- fs: 12,
- tr: { v: 0, a: 1 },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-});
-
-test('Test setTextRotation', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 setTextRotation
- range.setTextRotation(1);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- expect(A1Style).toEqual({
- fs: 12,
- tr: {
- v: 0,
- a: 1,
- },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-});
-
-test('Test setTextStyle', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1');
-
- // set A1 setTextStyle
- range.setTextStyle({
- ff: '黑体',
- fs: 18,
- bl: 1,
- });
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- expect(A1Style).toEqual({
- ff: '黑体',
- fs: 18,
- bl: 1,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-});
-
-test('Test setTextStyles', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B1');
-
- // set A1 setTextStyle
- range.setTextStyles([
- [
- {
- ff: '黑体',
- fs: 18,
- bl: 1,
- },
- {
- ff: '宋体',
- fs: 24,
- bl: 0,
- },
- ],
- ]);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- expect(A1Style).toEqual({
- ff: '黑体',
- fs: 18,
- bl: 1,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-});
-
-test('Test setVerticalText', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1');
-
- // set A1 setVerticalText
- range.setVerticalText(1);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- expect(A1Style).toEqual({
- fs: 12,
- tr: {
- a: 90,
- v: 1,
- },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-});
-
-test('Test setWrap', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1');
-
- // set A1 setWrap
- range.setWrap(1);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- expect(A1Style).toEqual({
- fs: 12,
- tb: 1,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-});
-
-test('Test setWraps', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1');
-
- // set A1 setWraps
- range.setWraps([[1, 1]]);
-
- const A1 = worksheet.getCellMatrix().getValue(0, 0);
- const A1Style = workbook.getStyles().get(A1 && A1.s);
-
- expect(A1Style).toEqual({
- fs: 12,
- tb: 1,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous style
- const preA1 = worksheet.getCellMatrix().getValue(0, 0);
- const preA1Style = workbook.getStyles().get(preA1 && preA1.s);
- expect(preA1Style).toEqual({
- fs: 12,
- });
-});
-
-test('Test activate Range', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B1');
-
- const rangeData = range.activate().getRangeData();
-
- const activeRange = worksheet.getSelection().getActiveRange().getRangeData();
-
- expect(rangeData).toEqual(activeRange);
-});
-
-test('Test activateAsCurrentCell', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('B1');
-
- const activeCurrentCell = range.activateAsCurrentCell().getRangeData();
-
- const CurrentCell = worksheet.getSelection().getCurrentCell().getRangeData();
-
- expect(activeCurrentCell).toEqual(CurrentCell);
-});
-
-test('Test isIntersection', () => {
- let { worksheet, workbook } = demo();
-
- const currentRange = worksheet.getRange('A1:C5');
-
- const range = worksheet.getRange('B1:D3');
-
- const isInter = currentRange.isIntersection(range);
-
- expect(isInter).toEqual(true);
-});
-test('Test clearContent', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B1');
- range.clearContent();
- const data = range.getObjectValues();
-
- expect(data).toEqual({
- 0: {
- 0: {
- s: 1,
- v: '',
- m: '',
- },
- 1: {
- s: 1,
- v: '',
- m: '',
- },
- },
- });
-});
-
-test('Test clearNote', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B1');
- range.clearNote();
- const data = range.getObjectValues();
-
- expect(data).toEqual({
- 0: {
- 0: {
- s: 1,
- v: '1',
- m: '1',
- },
- 1: {
- s: 1,
- v: 1,
- m: '1',
- },
- },
- });
-});
-
-test('Test removeDuplicates', () => {
- const container = createCoreTestContainer({
- styles: {},
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 3,
- m: '3',
- },
- 1: {
- s: '1',
- v: 4,
- m: '4',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 3,
- m: '3',
- },
- 1: {
- s: '1',
- v: 4,
- m: '4',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B4');
-
- range.removeDuplicates();
- const data = range.getObjectValues();
- expect(data).toEqual({
- 0: {
- 0: { s: 1, v: 1, m: '1' },
- 1: { s: 1, v: 2, m: '2' },
- },
- 1: {
- 0: { s: 1, v: 3, m: '3' },
- 1: { s: 1, v: 4, m: '4' },
- },
- 2: { 0: {}, 1: {} },
- 3: { 0: {}, 1: {} },
- });
-});
-
-test('Test getColumnMatrix', () => {
- const container = createCoreTestContainer({
- styles: {},
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 3,
- m: '3',
- },
- 1: {
- s: '1',
- v: 4,
- m: '4',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B2');
-
- const A = range.getColumnMatrix(0).getData();
- const B = range.getRowMatrix(1).getData();
-
- expect(A).toEqual({
- 0: {
- 0: { s: 1, v: 1, m: '1' },
- },
- 1: {
- 0: { s: 1, v: 3, m: '3' },
- },
- });
-
- expect(B).toEqual({
- 1: {
- 0: { s: 1, v: 3, m: '3' },
- 1: { s: 1, v: 4, m: '4' },
- },
- });
-});
-
-test('Test isBlank', () => {
- const container = createCoreTestContainer({
- styles: {},
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 3,
- m: '3',
- },
- 1: {
- s: '1',
- v: 4,
- m: '4',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1:B2');
-
- const A = range.isBlank();
-
- expect(A).toEqual(false);
-});
-
-test('Test getA1Notation', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange(0, 0, 1, 4);
-
- const A1 = range.getA1Notation();
-
- expect(A1).toEqual('A1:E2');
-});
-
-// test('Test getFormulas/getFormual', () => {
-// const container = IOCContainerStartUpReady({
-// styles: {},
-// });
-// const context = container.getSingleton<SheetContext>('SheetContext');
-// const workbook = container.getSingleton<WorkBook>('WorkBook');
-// const commandManager = workbook.getCommandManager();
-
-// const configure = {
-// sheetId: 'sheet',
-// cellData: {
-// 0: {
-// 0: {
-// s: 1,
-// v: 1,
-// m: '1',
-// f: 'SUM(1,2)',
-// },
-// 1: {
-// s: 1,
-// v: 2,
-// m: '2',
-// f: 'SUM(3,4)',
-// },
-// },
-// },
-// status: 1,
-// };
-// const worksheet = new WorkSheet(context, configure);
-// workbook.insertSheet(worksheet);
-// worksheet.setCommandManager(commandManager);
-
-// const range1 = worksheet.getRange('A1');
-
-// const formula = range1.getFormula();
-
-// expect(formula).toEqual('SUM(1,2)');
-
-// const range2 = worksheet.getRange('A1:B1');
-
-// const formulas = range2.getFormulas();
-
-// expect(formulas).toEqual([['SUM(1,2)', 'SUM(3,4)']]);
-// });
-
-// test('Test autoFill bottom', () => {
-// const container = IOCContainerStartUpReady({
-// styles: {},
-// });
-// const context = container.getSingleton<SheetContext>('SheetContext');
-// const workbook = container.getSingleton<WorkBook>('WorkBook');
-// const commandManager = workbook.getCommandManager();
-
-// const configure = {
-// sheetId: 'sheet',
-// cellData: {
-// 0: {
-// 0: {
-// s: 1,
-// v: 1,
-// m: '1',
-// fm: {
-// f: 'g',
-// t: FormatType.NUMBER,
-// },
-// },
-// 1: {
-// s: 1,
-// v: 2,
-// m: '2',
-// },
-// },
-// },
-// status: 1,
-// };
-// const worksheet = new WorkSheet(context, configure);
-// workbook.insertSheet(worksheet);
-// worksheet.setCommandManager(commandManager);
-
-// const range = worksheet.getRange('A1');
-// const sourceRange = worksheet.getRange('A1:A5');
-// range.autoFill(sourceRange, AutoFillSeries.DEFAULT_SERIES);
-
-// const A5 = worksheet.getCellMatrix().getValue(4, 0);
-
-// expect(A5).toEqual({
-// 0: {
-// s: 1,
-// v: 1,
-// m: '1',
-// fm: {
-// f: 'g',
-// t: FormatType.NUMBER,
-// },
-// },
-// });
-// });
-
-// test('Test autoFill right', () => {
-// const container = IOCContainerStartUpReady({
-// styles: {},
-// });
-// const context = container.getSingleton<SheetContext>('SheetContext');
-// const workbook = container.getSingleton<WorkBook>('WorkBook');
-// const commandManager = workbook.getCommandManager();
-
-// const configure = {
-// sheetId: 'sheet',
-// cellData: {
-// 0: {
-// 0: {
-// v: 1,
-// m: '1',
-// fm: {
-// f: 'g',
-// t: FormatType.NUMBER,
-// },
-// },
-// 1: {
-// v: 2,
-// m: '2',
-// fm: {
-// f: 'g',
-// t: FormatType.NUMBER,
-// },
-// },
-// },
-// 1: {
-// 0: {
-// v: 2,
-// m: '2',
-// fm: {
-// f: 'g',
-// t: FormatType.NUMBER,
-// },
-// },
-// },
-// },
-// status: 1,
-// };
-// const worksheet = new WorkSheet(context, configure);
-// workbook.insertSheet(worksheet);
-// worksheet.setCommandManager(commandManager);
-
-// const range = worksheet.getRange('A1:B1');
-// const sourceRange = worksheet.getRange('A1:D1');
-// range.autoFill(sourceRange, AutoFillSeries.DEFAULT_SERIES);
-
-// const a = worksheet.getCellMatrix().getMatrix();
-// const D1 = worksheet.getCellMatrix().getValue(0, 3);
-
-// expect(D1).toEqual({
-// 3: {
-// 0: {
-// s: 1,
-// v: 1,
-// m: '1',
-// fm: {
-// f: 'g',
-// t: FormatType.NUMBER,
-// },
-// },
-// },
-// });
-// });
-
-test('Test getGridId', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange(1, 1, 2, 5);
-
- const A1 = range.getGridId();
-
- expect(A1).toEqual('sheet');
-});
-
-// test('Test getFormulas/getFormual', () => {
-// const container = IOCContainerStartUpReady({
-// styles: {},
-// });
-// const context = container.getSingleton<SheetContext>('SheetContext');
-// const workbook = container.getSingleton<WorkBook>('WorkBook');
-// const commandManager = workbook.getCommandManager();
-
-// const configure = {
-// sheetId: 'sheet',
-// cellData: {
-// 0: {
-// 0: {
-// s: 1,
-// v: 1,
-// m: '1',
-// n: '111',
-// },
-// 1: {
-// s: 1,
-// v: 2,
-// m: '2',
-// n: '222',
-// },
-// },
-// },
-// status: 1,
-// };
-// const worksheet = new WorkSheet(context, configure);
-// workbook.insertSheet(worksheet);
-// worksheet.setCommandManager(commandManager);
-
-// const range1 = worksheet.getRange('A1');
-
-// const note = range1.getNote();
-
-// expect(note).toEqual('111');
-
-// const range2 = worksheet.getRange('A1:B1');
-
-// const notes = range2.getNotes();
-
-// expect(notes).toEqual([['111', '222']]);
-// });
-
-// test('Test getNumberFormat/getNumberFormats', () => {
-// const container = IOCContainerStartUpReady({
-// styles: {},
-// });
-// const context = container.getSingleton<SheetContext>('SheetContext');
-// const workbook = container.getSingleton<WorkBook>('WorkBook');
-// const commandManager = workbook.getCommandManager();
-
-// const configure = {
-// sheetId: 'sheet',
-// cellData: {
-// 0: {
-// 0: {
-// s: 1,
-// v: 1,
-// m: '1',
-// fm: {
-// f: 'g',
-// t: FormatType.NUMBER,
-// },
-// },
-// 1: {
-// s: 1,
-// v: 2,
-// m: '2',
-// fm: {
-// f: 'g',
-// t: FormatType.TEXT,
-// },
-// },
-// },
-// },
-// status: 1,
-// };
-// const worksheet = new WorkSheet(context, configure);
-// workbook.insertSheet(worksheet);
-// worksheet.setCommandManager(commandManager);
-
-// const range1 = worksheet.getRange('A1:B1');
-// const formats = range1.getNumberFormats();
-
-// const range2 = worksheet.getRange('A1');
-// const format = range2.getNumberFormat();
-
-// expect(formats).toEqual([['g', 'g']]);
-// expect(format).toEqual('g');
-// });
-
-test('Test getHeight', () => {
- let { worksheet } = demo();
-
- const range = worksheet.getRange('A1:B2');
-
- const h = range.getHeight();
-
- // defaultRowHeight: 27,
- expect(h).toEqual(27 * 2);
-});
-
-test('Test getWidth', () => {
- let { worksheet } = demo();
-
- const range = worksheet.getRange('A1:B2');
-
- const w = range.getWidth();
-
- // defaultColumnWidth: 93,
- expect(w).toEqual(93 * 2);
-});
-
-test('Test trimWhitespace', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: '1 1',
- m: '1 1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const range = worksheet.getRange('A1');
-
- range.trimWhitespace();
-
- const A1 = worksheet.getRange('A1').getValue()?.m;
- expect(A1).toEqual('11');
-});
-
-test('Test getNextDataCell', () => {
- let { worksheet } = demo();
-
- const range = worksheet.getRange('C3:D3');
-
- const cellTop = range.getNextDataCell(Direction.UP).getA1Notation();
- expect(cellTop).toEqual('C1');
-
- const cellBottom = range.getNextDataCell(Direction.DOWN).getA1Notation();
- expect(cellBottom).toEqual('C31');
-
- const cellLeft = range.getNextDataCell(Direction.LEFT).getA1Notation();
- expect(cellLeft).toEqual('A3');
-
- const cellRight = range.getNextDataCell(Direction.RIGHT).getA1Notation();
- expect(cellRight).toEqual('K3');
-});
-
-test('Test getDataRegion', () => {
- let { worksheet } = demo();
-
- const range = worksheet.getRange('C3:D3');
-
- const cellColumns = range.getDataRegion(Dimension.COLUMNS).getA1Notation();
- expect(cellColumns).toEqual('B1:C3');
-
- const cellRows = range.getDataRegion(Dimension.ROWS).getA1Notation();
- expect(cellRows).toEqual('A2:C3');
-
- const cell = range.getDataRegion().getA1Notation();
- expect(cell).toEqual('B3:C3');
-});
-
-test('Test getRichTextValues/getRichTextValue', () => {
- let { worksheet } = demo();
-
- const ranges = worksheet.getRange('A1:B1');
- const cells = ranges.getRichTextValues();
- expect(cells).toEqual([['', '']]);
-
- const range = worksheet.getRange('A1');
- const cell = range.getRichTextValue();
- expect(cell).toEqual('');
-});
-
-test('Test setRangeData', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B1');
-
- const newData: ICellData = {
- s: {
- bg: {
- rgb: 'red',
- },
- },
- v: 11,
- m: '11',
- };
-
- range.setRangeData(newData);
- const currentRangeValues = range.getValues();
- expect(currentRangeValues).toEqual([
- [
- {
- v: 11,
- m: '11',
- s: '12345678',
- },
- {
- v: 11,
- m: '11',
- s: '12345678',
- },
- ],
- ]);
-
- // undo
- worksheet.getCommandManager().undo();
- const preRangeValues = range.getValues();
-
- expect(preRangeValues).toEqual([
- [
- {
- s: '1',
- v: '1',
- m: '1',
- },
- {
- s: '1',
- v: 1,
- m: '1',
- },
- ],
- ]);
-
- // redo
- worksheet.getCommandManager().redo();
- const nextRangeValues = range.getValues();
-
- expect(nextRangeValues).toEqual([
- [
- {
- v: 11,
- m: '11',
- s: '12345678',
- },
- {
- v: 11,
- m: '11',
- s: '12345678',
- },
- ],
- ]);
-});
-
-// test('Test setNumberFormat', () => {
-// let { worksheet, workbook } = demo();
-
-// const range = worksheet.getRange('A1');
-
-// range.setNumberFormat('0.000');
-// const cell = range.getNumberFormat();
-// expect(cell).toEqual('0.000');
-
-// // undo
-// worksheet.getCommandManager().undo();
-// const uncell = range.getNumberFormat();
-// expect(uncell).toEqual('');
-
-// // redo
-// worksheet.getCommandManager().redo();
-// const recell = range.getNumberFormat();
-// expect(recell).toEqual('0.000');
-// });
-
-// test('Test setNumberFormats', () => {
-// let { worksheet, workbook } = demo();
-
-// const range = worksheet.getRange('A1:B1');
-
-// range.setNumberFormats([['0.000', '0.000']]);
-// const cell = range.getNumberFormats();
-// expect(cell).toEqual([['0.000', '0.000']]);
-
-// // undo
-// worksheet.getCommandManager().undo();
-// const undoValue = worksheet.getCellMatrix().getValue(0, 0);
-// const uncell = range.getNumberFormats();
-// expect(uncell).toEqual([['', '']]);
-
-// // redo
-// worksheet.getCommandManager().redo();
-// // const redoValue = worksheet.getCellMatrix().getValue(0, 0);
-// const recell = range.getNumberFormats();
-// expect(recell).toEqual([['0.000', '0.000']]);
-// });
-
-// test('Test setFormulas', () => {
-// let { worksheet, workbook } = demo();
-
-// const range = worksheet.getRange('A1:B1');
-
-// range.setFormulas([['=SUM(1,2)', '=SUM(1,2)']]);
-// const cell = range.getFormulas();
-// expect(cell).toEqual([['=SUM(1,2)', '=SUM(1,2)']]);
-
-// // undo
-// worksheet.getCommandManager().undo();
-// const uncell = range.getFormulas();
-// expect(uncell).toEqual([['', '']]);
-
-// // redo
-// worksheet.getCommandManager().redo();
-// const recell = range.getFormulas();
-// expect(recell).toEqual([['=SUM(1,2)', '=SUM(1,2)']]);
-// });
-
-// test('Test setFormula', () => {
-// let { worksheet, workbook } = demo();
-
-// const range = worksheet.getRange('A1:B1');
-
-// range.setFormula('=SUM(1,2)');
-
-// const cell = range.getFormula();
-// expect(cell).toEqual('=SUM(1,2)');
-
-// // undo
-// worksheet.getCommandManager().undo();
-// const uncell = range.getFormula();
-// expect(uncell).toEqual('');
-
-// // redo
-// worksheet.getCommandManager().redo();
-// const recell = range.getFormula();
-// expect(recell).toEqual('=SUM(1,2)');
-// });
-// test('Test setNotes', () => {
-// let { worksheet, workbook } = demo();
-
-// const range = worksheet.getRange('A1:B1');
-
-// range.setNotes([['note1', 'note2']]);
-
-// const cell = range.getNotes();
-// expect(cell).toEqual([['note1', 'note2']]);
-
-// // undo
-// worksheet.getCommandManager().undo();
-// const uncell = range.getNotes();
-// expect(uncell).toEqual([['', '']]);
-
-// // redo
-// worksheet.getCommandManager().redo();
-// const recell = range.getNotes();
-// expect(recell).toEqual([['note1', 'note2']]);
-// });
-// test('Test setNote', () => {
-// let { worksheet, workbook } = demo();
-
-// const range = worksheet.getRange('A1:B1');
-
-// range.setNote('note');
-
-// const cell = range.getNote();
-// expect(cell).toEqual('note');
-
-// // undo
-// worksheet.getCommandManager().undo();
-// const uncell = range.getNote();
-// expect(uncell).toEqual('');
-
-// // redo
-// worksheet.getCommandManager().redo();
-// const recell = range.getNote();
-// expect(recell).toEqual('note');
-// });
-
-test('Test randomize', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B5');
-
- range.randomize();
- // TODO
-});
-
-test('Test getMergedRanges', () => {
- let { worksheet } = demo();
-
- const range = worksheet.getRange('A1:B3');
-
- const merge = range.getMergedRanges();
- expect(merge).toEqual({
- endColumn: 2,
- endRow: 2,
- startColumn: 1,
- startRow: 1,
- });
-});
-
-test('Test mergeAcross', () => {
- let { worksheet } = demo();
-
- const range = worksheet.getRange('A1:B3');
-
- range.mergeAcross();
-
- const merge = worksheet.getMerges();
-
- expect(merge.getByRowColumn(1, 1)).not.toBeUndefined();
-});
-
-test('Test mergeVertically', () => {
- let { worksheet, workbook } = demo();
-
- const range = worksheet.getRange('A1:B3');
-
- range.mergeVertically();
- const merge = worksheet.getMerges();
- expect(merge.getByRowColumn(1, 1)).not.toBeUndefined();
-});
-
-// test('Test createFilter', () => {
-// let { worksheet, workbook } = demo();
-
-// const range = worksheet.getRange('A1:B3');
-
-// range.createFilter();
-// // TODO
-// });
-// test('Test setCellId', () => {
-// let { worksheet, workbook } = demo();
-
-// const range = worksheet.getRange('A1');
-
-// range.setCellId();
-
-// let currentCell = worksheet.getCellMatrix().getValue(0, 0);
-
-// // use mock data
-// expect(currentCell?.id).toHaveLength(8);
-
-// range.setCellId('cell-01');
-
-// currentCell = worksheet.getCellMatrix().getValue(0, 0);
-
-// expect(currentCell).toEqual({ s: 1, v: '1', m: '1', id: 'cell-01' });
-// });
diff --git a/packages/core/test/Domain/RangeList.test.ts b/packages/core/test/Domain/RangeList.test.ts
deleted file mode 100644
index 8b3687ba25..0000000000
--- a/packages/core/test/Domain/RangeList.test.ts
+++ /dev/null
@@ -1,690 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { SheetContext } from '../../src/Basics/SheetContext';
-import { Workbook } from '../../src/Sheets/Domain/Workbook';
-import { Worksheet } from '../../src/Sheets/Domain/Worksheet';
-import { BooleanNumber, WrapStrategy } from '../../src/Types/Enum';
-import { TestInit } from '../ContainerStartUp';
-import { createCoreTestContainer } from './Range.test';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-// TODO performance test, 1000 times
-// TODO 修复RangeList单元测试报错
-
-test('Test RangeList setValue', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- // set new value
- rangeList.setValue(3);
-
- const currentCell = worksheet.getCellMatrix().getValue(0, 0);
-
- expect(currentCell).toEqual({ v: 3, m: '3' });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = worksheet.getCellMatrix().getValue(0, 0);
- expect(preCell).toEqual({ s: 1, v: 1, m: '1' });
-});
-
-test('Test RangeList clear', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- // clear
- rangeList.clear({ formatOnly: true, contentsOnly: true });
-
- // test current A1 B1
- const currentA = worksheet?.getCellMatrix()?.getValue(0, 0);
- const currentB = worksheet?.getCellMatrix()?.getValue(0, 1);
-
- expect(currentA).toEqual({ v: '', m: '' });
- expect(currentB).toEqual({ v: '', m: '' });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous A1 B1
- const preA = worksheet?.getCellMatrix()?.getValue(0, 0);
- const preB = worksheet?.getCellMatrix()?.getValue(0, 1);
-
- expect(preA).toEqual({ s: 1, v: 1, m: '1' });
- expect(preB).toEqual({ s: 1, v: 2, m: '2' });
-});
-
-function demo() {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 111,
- m: '1 11',
- },
- 1: {
- s: '1',
- v: 222,
- m: '2 22',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
- return worksheet;
-}
-
-test('Test RangeList setFontSize', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setFontSize(20);
-
- const cell = range.getFontSizes();
-
- expect(cell).toEqual([[20, 20]]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getFontSizes();
- expect(preCell).toEqual([[12, 12]]);
-});
-
-test('Test RangeList setFontFamily', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setFontFamily('宋体');
-
- const cell = range.getFontFamilies();
-
- expect(cell).toEqual([['宋体', '宋体']]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getFontFamilies();
- expect(preCell).toEqual([['', '']]);
-});
-
-test('Test RangeList setUnderline', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setUnderline(BooleanNumber.TRUE);
-
- const cell = range.getUnderlines();
-
- expect(cell).toEqual([[{ s: BooleanNumber.TRUE }, { s: BooleanNumber.TRUE }]]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getUnderlines();
- expect(preCell).toEqual([
- [{ s: BooleanNumber.FALSE }, { s: BooleanNumber.FALSE }],
- ]);
-});
-
-test('Test RangeList setOverline', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setOverline(BooleanNumber.TRUE);
-
- const cell = range.getOverlines();
-
- expect(cell).toEqual([[{ s: BooleanNumber.TRUE }, { s: BooleanNumber.TRUE }]]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getOverlines();
- expect(preCell).toEqual([
- [{ s: BooleanNumber.FALSE }, { s: BooleanNumber.FALSE }],
- ]);
-});
-
-test('Test RangeList setStrikeThrough', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setStrikeThrough(BooleanNumber.TRUE);
-
- const cell = range.getStrikeThroughs();
-
- expect(cell).toEqual([[{ s: BooleanNumber.TRUE }, { s: BooleanNumber.TRUE }]]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getStrikeThroughs();
- expect(preCell).toEqual([
- [{ s: BooleanNumber.FALSE }, { s: BooleanNumber.FALSE }],
- ]);
-});
-
-test('Test RangeList setFontStyle', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setFontStyle(1);
-
- const cell = range.getFontStyles();
-
- expect(cell).toEqual([[1, 1]]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getFontStyles();
- expect(preCell).toEqual([[0, 0]]);
-});
-
-test('Test RangeList setFontWeight', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setFontWeight(1);
-
- const cell = range.getFontWeights();
-
- expect(cell).toEqual([[1, 1]]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getFontWeights();
- expect(preCell).toEqual([[0, 0]]);
-});
-
-test('Test RangeList setHorizontalAlignment', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setHorizontalAlignment(1);
-
- const cell = range.getHorizontalAlignments();
-
- expect(cell).toEqual([[1, 1]]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getHorizontalAlignments();
- expect(preCell).toEqual([[0, 0]]);
-});
-
-test('Test RangeList setTextDirection', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setTextDirection(1);
-
- const cell = range.getTextDirections();
-
- expect(cell).toEqual([[1, 1]]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getTextDirections();
- expect(preCell).toEqual([[0, 0]]);
-});
-
-test('Test RangeList setTextRotation', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setTextRotation(90);
-
- const cell = range.getTextRotations();
-
- expect(cell).toEqual([
- [
- {
- a: 90,
- v: 0,
- },
- {
- a: 90,
- v: 0,
- },
- ],
- ]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getTextRotations();
- expect(preCell).toEqual([
- [
- {
- a: 0,
- v: 0,
- },
- {
- a: 0,
- v: 0,
- },
- ],
- ]);
-});
-
-test('Test RangeList setVerticalAlignment', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setVerticalAlignment(1);
-
- const cell = range.getVerticalAlignments();
-
- expect(cell).toEqual([[1, 1]]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getVerticalAlignments();
- expect(preCell).toEqual([[0, 0]]);
-});
-
-test('Test RangeList setWrapStrategy', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setWrapStrategy(WrapStrategy.CLIP);
-
- const cell = range.getWrapStrategies();
-
- expect(cell).toEqual([[WrapStrategy.CLIP, WrapStrategy.CLIP]]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getWrapStrategies();
- expect(preCell).toEqual([[WrapStrategy.UNSPECIFIED, WrapStrategy.UNSPECIFIED]]);
-});
-
-test('Test activate RangeList', () => {
- const { workbook, worksheet } = TestInit();
-
- const rangeList = worksheet.getRangeList(['A1:B1', 'A3:B4']);
-
- const rangeData = rangeList.activate();
-
- const activeRange = worksheet.getSelection().getActiveRangeList();
-
- expect(rangeData).toEqual(activeRange);
-});
-
-test('Test RangeList setFontColor', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setFontColor('#FFF');
-
- const cell = range.getFontColors();
-
- expect(cell).toEqual([['#FFF', '#FFF']]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getFontColors();
- expect(preCell).toEqual([['#000', '#000']]);
-});
-
-test('Test RangeList setWrap', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setWrap(1);
-
- const cell = range.getWraps();
-
- expect(cell).toEqual([[1, 1]]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getWraps();
- expect(preCell).toEqual([[0, 0]]);
-});
-
-test('Test RangeList setVerticalText', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- const range = worksheet.getRange('A1:B1');
-
- rangeList.setVerticalText(1);
-
- const cell = range.getTextRotations();
-
- expect(cell).toEqual([
- [
- {
- a: 90,
- v: 1,
- },
- {
- a: 90,
- v: 1,
- },
- ],
- ]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- const preCell = range.getTextRotations();
- expect(preCell).toEqual([
- [
- {
- a: 0,
- v: 0,
- },
- {
- a: 0,
- v: 0,
- },
- ],
- ]);
-});
-
-// test('Test RangeList setFormula', () => {
-// const worksheet = demo();
-
-// const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
-// const range = worksheet.getRange('A1:B1');
-
-// rangeList.setFormula('=SUM(1,2)');
-
-// const cell = range.getFormula();
-
-// expect(cell).toEqual('=SUM(1,2)');
-
-// // undo
-// worksheet.getCommandManager().undo();
-
-// // test previous value
-// const preCell = range.getFormula();
-// expect(preCell).toEqual('');
-// });
-
-// test('Test RangeList setNote', () => {
-// const worksheet = demo();
-
-// const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
-// const range = worksheet.getRange('A1:B1');
-
-// rangeList.setNote('1');
-
-// const cell = range.getNote();
-
-// expect(cell).toEqual('1');
-
-// // undo
-// worksheet.getCommandManager().undo();
-
-// // test previous value
-// const preCell = range.getNote();
-// expect(preCell).toEqual('');
-// });
-
-// test('Test RangeList setNumberFormat', () => {
-// const worksheet = demo();
-
-// const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
-// const range = worksheet.getRange('A1:B1');
-
-// rangeList.setNumberFormat('#.##');
-
-// const cell = range.getNumberFormat();
-
-// expect(cell).toEqual('#.##');
-
-// // undo
-// worksheet.getCommandManager().undo();
-
-// // test previous value
-// const preCell = range.getNumberFormat();
-// expect(preCell).toEqual('');
-// });
-
-test('Test RangeList setBackground', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- rangeList.setBackground('red');
-
- const range = worksheet.getRange('A1:B1');
- const bg = range.getBackgrounds();
- expect(bg).toEqual([['red', 'red']]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- // defined background : #fff
- const preRange = worksheet.getRange('A1:B1');
- const preBg = preRange.getBackgrounds();
- expect(preBg).toEqual([[undefined, undefined]]);
-});
-
-test('Test RangeList setBackgroundRGB', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- rangeList.setBackgroundRGB(0, 0, 0);
-
- const range = worksheet.getRange('A1:B1');
- const bg = range.getBackgrounds();
- expect(bg).toEqual([['RGB(0,0,0)', 'RGB(0,0,0)']]);
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous value
- // defined background : #fff
- const preRange = worksheet.getRange('A1:B1');
- const preBg = preRange.getBackgrounds();
- expect(preBg).toEqual([[undefined, undefined]]);
-});
-
-test('Test RangeList trimWhitespace', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- rangeList.trimWhitespace();
- const range = worksheet.getRange('A1:B1');
- const value = range.getValues();
- expect(value).toEqual([
- [
- { s: 1, m: '111', v: '111' },
- { s: 1, m: '222', v: '222' },
- ],
- ]);
-});
-
-test('Test RangeList clearFormat', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- rangeList.clearFormat();
-
- // TODO
-});
-test('Test RangeList clearContent', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- rangeList.clearContent();
-
- // TODO
-});
-test('Test RangeList clearNote', () => {
- const worksheet = demo();
-
- const rangeList = worksheet.getRangeList(['A1', 'B1']);
-
- rangeList.clearNote();
-
- // TODO
-});
diff --git a/packages/core/test/Domain/Request.test.ts b/packages/core/test/Domain/Request.test.ts
deleted file mode 100644
index 2b5ec54292..0000000000
--- a/packages/core/test/Domain/Request.test.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-const http = require('http');
-
-export function post(action: string, send: object, callback: any) {
- const data = JSON.stringify(send);
- const options = {
- hostname: 'http://127.0.0.1:3998',
- port: '', // do not set 8080
- path: action,
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- 'Content-Length': data.length,
- },
- };
-
- const req = http.request(options, (res: any) => {
- // A post variable is defined to temporarily store the information of the request body
- let body = '';
- res.setEncoding('utf8');
- // Through the data event monitoring function of res, whenever the data of the request body is received, it is added to the post variable
- res.on('data', (chunk: any) => {
- body += chunk;
- });
- // After the end event of res is triggered, the post is parsed into a real POST request format through JSON.parse, and then the passed callback function is called to process the data
- res.on('end', () => {
- const json = JSON.parse(body);
-
- callback(json);
- });
- });
- req.on('error', (e: any) => {
- console.log(`problem with request: ${e.message}`);
- });
- req.write(data);
- req.end();
-}
diff --git a/packages/core/test/Domain/Selection.test.ts b/packages/core/test/Domain/Selection.test.ts
deleted file mode 100644
index 4d924c5a96..0000000000
--- a/packages/core/test/Domain/Selection.test.ts
+++ /dev/null
@@ -1,5154 +0,0 @@
-/* eslint-disable max-lines-per-function */
-
-/**
- * @jest-environment jsdom
- */
-import { Direction, Nullable, Range, Selection } from '../../src';
-import { SheetContext } from '../../src/Basics/SheetContext';
-import { Workbook } from '../../src/Sheets/Domain/Workbook';
-import { Worksheet } from '../../src/Sheets/Domain/Worksheet';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-function demo() {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: 'a',
- },
- 1: {
- s: '1',
- v: 1,
- m: 'ab',
- },
- 2: {
- s: '1',
- v: 1,
- m: 'Abc',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: 'c',
- },
- 1: {
- s: '1',
- v: 1,
- m: 'cD',
- },
- 2: {
- s: '1',
- v: 1,
- m: 'cde',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- return { worksheet, workbook };
-}
-
-test('Test setSelection', () => {
- const { workbook, worksheet } = demo();
- workbook.insertSheet(worksheet);
- const commandManager = workbook.getCommandManager();
- worksheet.setCommandManager(commandManager);
- worksheet.getSelection().setWorkSheet(worksheet);
-});
-
-test('Test getSelection', () => {
- const { workbook, worksheet } = demo();
- workbook.insertSheet(worksheet);
- const commandManager = workbook.getCommandManager();
- worksheet.setCommandManager(commandManager);
- const rangeData = {
- startRow: 1,
- endRow: 3,
- startColumn: 1,
- endColumn: 3,
- };
- worksheet.getSelection().setSelection({ selection: rangeData });
- const selection = worksheet.getSelection().getSelection();
- expect(selection).toEqual({
- startRow: 1,
- endRow: 3,
- startColumn: 1,
- endColumn: 3,
- });
-});
-
-test('Test getActiveSheet', () => {
- const { workbook, worksheet } = demo();
- workbook.insertSheet(worksheet);
- const commandManager = workbook.getCommandManager();
- worksheet.setCommandManager(commandManager);
- const sheet = worksheet.getSelection().getActiveSheet();
- if (!sheet) return;
- expect(sheet.getSheetId()).toEqual('sheet');
-});
-
-test('Test setSelection', () => {
- const { workbook, worksheet } = demo();
- workbook.insertSheet(worksheet);
- const commandManager = workbook.getCommandManager();
- worksheet.setCommandManager(commandManager);
-
- // set first selection
-
- const rangeData = {
- startRow: 1,
- endRow: 1,
- startColumn: 1,
- endColumn: 1,
- };
-
- worksheet.getSelection().setSelection({ selection: rangeData });
- const range: Nullable<Range> = worksheet.getSelection().getActiveRange();
-
- expect(range && range.getRangeData()).toEqual({
- startRow: 1,
- endRow: 1,
- startColumn: 1,
- endColumn: 1,
- });
-
- // set second selection
- const nextData = {
- startRow: 2,
- endRow: 2,
- startColumn: 2,
- endColumn: 2,
- };
- worksheet.getSelection().setSelection({ selection: nextData });
-
- const nextRange: Nullable<Range> = worksheet.getSelection().getActiveRange();
- expect(nextRange && nextRange.getRangeData()).toEqual({
- startRow: 2,
- endRow: 2,
- startColumn: 2,
- endColumn: 2,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- const undoRange: Nullable<Range> = worksheet.getSelection().getActiveRange();
- expect(undoRange && undoRange.getRangeData()).toEqual({
- startRow: 1,
- endRow: 1,
- startColumn: 1,
- endColumn: 1,
- });
-
- // undo
- worksheet.getCommandManager().redo();
-
- const redoRange: Nullable<Range> = worksheet.getSelection().getActiveRange();
- expect(redoRange && redoRange.getRangeData()).toEqual({
- startRow: 2,
- endRow: 2,
- startColumn: 2,
- endColumn: 2,
- });
-
- const errorData = {
- startRow: -1,
- endRow: 1,
- startColumn: 1,
- endColumn: 1,
- };
-
- worksheet.getSelection().setSelection({ selection: errorData });
- // test range type
- const typeData = {
- startRow: 2,
- endRow: 2,
- startColumn: 2,
- endColumn: 2,
- };
- worksheet.getSelection().setSelection({ selection: typeData });
-
- const typeRange: Nullable<Range> = worksheet.getSelection().getActiveRange();
- worksheet.getSelection().setSelection({ selection: typeRange });
-
- const typeData1 = {
- startRow: -1,
- endRow: 2,
- startColumn: 2,
- endColumn: 2,
- };
- worksheet.getSelection().setSelection({ selection: typeData1 });
-
- const typeRange1: Nullable<Range> = worksheet.getSelection().getActiveRange();
- worksheet.getSelection().setSelection({ selection: typeRange1 });
-
- // range array
- const arrData = [
- {
- startRow: 2,
- endRow: 2,
- startColumn: 2,
- endColumn: 2,
- },
- {
- startRow: 3,
- endRow: 3,
- startColumn: 3,
- endColumn: 3,
- },
- ];
- worksheet.getSelection().setSelection({ selection: arrData });
-
- const arrRange: Nullable<Range> = worksheet.getSelection().getActiveRange();
- worksheet.getSelection().setSelection({ selection: arrRange });
-
- const arrData1 = [
- {
- startRow: -1,
- endRow: 2,
- startColumn: 2,
- endColumn: 2,
- },
- {
- startRow: 3,
- endRow: 3,
- startColumn: 3,
- endColumn: 3,
- },
- ];
- worksheet.getSelection().setSelection({ selection: arrData1 });
-
- const arrRange1: Nullable<Range> = worksheet.getSelection().getActiveRange();
- worksheet.getSelection().setSelection({ selection: arrRange1 });
-
- // null type
- worksheet.getSelection().setSelection();
-
- // includes cell
- const cellRangeData = {
- startRow: 3,
- endRow: 5,
- startColumn: 3,
- endColumn: 5,
- };
- worksheet.getSelection().setSelection({
- selection: cellRangeData,
- cell: { startRow: 3, endRow: 3, startColumn: 3, endColumn: 3 },
- });
-
- worksheet.getSelection().setSelection({
- selection: cellRangeData,
- cell: { startRow: 7, endRow: 7, startColumn: 3, endColumn: 3 },
- });
-});
-
-test('Test setCurrentCell', () => {
- const { workbook, worksheet } = demo();
- workbook.insertSheet(worksheet);
- const commandManager = workbook.getCommandManager();
- worksheet.setCommandManager(commandManager);
-
- const prevRangeData = {
- startRow: 1,
- endRow: 1,
- startColumn: 1,
- endColumn: 1,
- };
-
- worksheet.getSelection().setSelection({ selection: prevRangeData });
- worksheet.getSelection().getSelection();
- worksheet.getSelection().getActiveSheet();
-
- const rangeData = {
- startRow: 2,
- endRow: 2,
- startColumn: 2,
- endColumn: 2,
- };
-
- worksheet.getSelection().setCurrentCell(rangeData);
- const range: Nullable<Range> = worksheet.getSelection().getCurrentCell();
-
- expect(range && range.getRangeData()).toEqual({
- startRow: 2,
- endRow: 2,
- startColumn: 2,
- endColumn: 2,
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- const undoRange: Nullable<Range> = worksheet.getSelection().getCurrentCell();
- expect(undoRange && undoRange.getRangeData()).toEqual({
- startRow: 1,
- endRow: 1,
- startColumn: 1,
- endColumn: 1,
- });
-
- // redo
- worksheet.getCommandManager().redo();
-
- const redoRange: Nullable<Range> = worksheet.getSelection().getCurrentCell();
- expect(redoRange && redoRange.getRangeData()).toEqual({
- startRow: 2,
- endRow: 2,
- startColumn: 2,
- endColumn: 2,
- });
- // range?.startRow === -1
- const wrongData = {
- startRow: -1,
- endRow: 2,
- startColumn: 2,
- endColumn: 2,
- };
- worksheet.getSelection().setCurrentCell(wrongData);
- // range type
- worksheet.getSelection().setCurrentCell(range);
- // !(range.startRow === range.endRow && range.startColumn === range.endColumn)
- const rangeData1 = {
- startRow: 3,
- endRow: 5,
- startColumn: 3,
- endColumn: 5,
- };
- worksheet.getSelection().setCurrentCell(rangeData1);
- // const rangeData2 = '123';
- // worksheet.getSelection().setCurrentCell(rangeData1);
-});
-
-test('Test cellInRange', () => {
- const { workbook, worksheet } = demo();
- workbook.insertSheet(worksheet);
- const commandManager = workbook.getCommandManager();
- worksheet.setCommandManager(commandManager);
- const rangeList = [
- {
- startRow: 2,
- endRow: 4,
- startColumn: 3,
- endColumn: 5,
- },
- ];
-
- Selection.cellInRange(rangeList, {
- startRow: 2,
- endRow: 2,
- startColumn: 3,
- endColumn: 3,
- });
- Selection.cellInRange(rangeList, {
- startRow: 1,
- endRow: 1,
- startColumn: 1,
- endColumn: 1,
- });
-});
-
-test('Test getNextDataRange:top1', () => {
- const { workbook, worksheet } = demo();
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 5: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- worksheet.getConfig().cellData = configure.cellData;
- workbook.insertSheet(worksheet);
- const commandManager = workbook.getCommandManager();
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 1,
- endRow: 3,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({ selection: rangeData });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.UP);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 1,
- endRow: 1,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-
-test('Test getNextDataRange:top2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 5: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 1,
- endRow: 3,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({ selection: rangeData });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.UP);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 1,
- endRow: 2,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-test('Test getNextDataRange:top2.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 5: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 1,
- endRow: 3,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({ selection: rangeData });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.UP);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 1,
- endRow: 1,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-test('Test getNextDataRange:top2.2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 5: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 2,
- endRow: 3,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({ selection: rangeData });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.UP);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 2,
- endRow: 2,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-
-test('Test getNextDataRange:top2.3', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 2,
- endRow: 2,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({ selection: rangeData });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.UP);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 2,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-
-test('Test getNextDataRange:top2.4', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 5: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 1,
- endRow: 5,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({ selection: rangeData });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.UP);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 1,
- endRow: 3,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-
-test('Test getNextDataRange:top2.5', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- v: 2,
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 5: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 2,
- endRow: 5,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 5,
- endRow: 5,
- startColumn: 1,
- endColumn: 3,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.UP);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 5,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-
-test('Test getNextDataRange:top3', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 5: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 4,
- endRow: 5,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 5,
- endRow: 5,
- startColumn: 1,
- endColumn: 1,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.UP);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 2,
- endRow: 5,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-
-test('Test getNextDataRange:top4', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- v: '1',
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 5: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 4,
- endRow: 5,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 5,
- endRow: 5,
- startColumn: 1,
- endColumn: 3,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.UP);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 3,
- endRow: 5,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-
-test('Test getNextDataRange:bottom1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- v: '1',
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- // worksheet.getConfig().rowCount = 3;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 1,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.DOWN);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 2,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-test('Test getNextDataRange:bottom1.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().rowCount = 3;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 1,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.DOWN);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 3,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-test('Test getNextDataRange:bottom2.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().rowCount = 3;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 1,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.DOWN);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 3,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-test('Test getNextDataRange:bottom2.2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().rowCount = 4;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 1,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.DOWN);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 4,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-test('Test getNextDataRange:bottom3.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().rowCount = 4;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 4,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 3,
- endRow: 3,
- startColumn: 1,
- endColumn: 1,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.DOWN);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 2,
- endRow: 4,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-test('Test getNextDataRange:bottom3.2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().rowCount = 4;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 4,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 3,
- endRow: 3,
- startColumn: 1,
- endColumn: 1,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.DOWN);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 3,
- endRow: 4,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-test('Test getNextDataRange:bottom4.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().rowCount = 4;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 4,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 3,
- endRow: 3,
- startColumn: 1,
- endColumn: 1,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.DOWN);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 1,
- endRow: 4,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-test('Test getNextDataRange:bottom4.2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- v: 3,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 3: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 4: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().rowCount = 4;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 4,
- startColumn: 1,
- endColumn: 3,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 3,
- endRow: 3,
- startColumn: 1,
- endColumn: 1,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.DOWN);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 3,
- endRow: 4,
- startColumn: 1,
- endColumn: 3,
- });
- }
-});
-test('Test getNextDataRange:left1.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: 1,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 4,
- endColumn: 5,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 0,
- endRow: 0,
- startColumn: 5,
- endColumn: 5,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.LEFT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 3,
- endColumn: 5,
- });
- }
-});
-
-test('Test getNextDataRange:left1.2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: 1,
- m: '2',
- },
- 3: {
- s: 1,
- m: '2',
- },
- 4: {
- s: 1,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 4,
- endColumn: 5,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 0,
- endRow: 0,
- startColumn: 5,
- endColumn: 5,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.LEFT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 5,
- });
- }
-});
-test('Test getNextDataRange:left2.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: 1,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 4,
- endColumn: 5,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 0,
- endRow: 0,
- startColumn: 5,
- endColumn: 5,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.LEFT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 2,
- endColumn: 5,
- });
- }
-});
-test('Test getNextDataRange:left2.2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 4,
- endColumn: 5,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 0,
- endRow: 0,
- startColumn: 5,
- endColumn: 5,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.LEFT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 5,
- });
- }
-});
-test('Test getNextDataRange:left3.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: '1',
- v: 2,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: 1,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 2,
- endColumn: 5,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.LEFT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 2,
- endColumn: 4,
- });
- }
-});
-
-test('Test getNextDataRange:left3.2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: 1,
- m: '2',
- },
- 4: {
- s: 1,
- m: '2',
- },
- 5: {
- s: 1,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 2,
- endColumn: 5,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.LEFT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 2,
- endColumn: 2,
- });
- }
-});
-
-test('Test getNextDataRange:left4.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 2,
- m: '2',
- },
- 3: {
- s: 1,
- m: '2',
- v: 2,
- },
- 4: {
- s: 1,
- m: '2',
- },
- 5: {
- s: 1,
- m: '2',
- v: 3,
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 2,
- endColumn: 5,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.LEFT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 2,
- endColumn: 3,
- });
- }
-});
-
-test('Test getNextDataRange:left4.2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: 1,
- m: 2,
- },
- 3: {
- s: 1,
- m: '2',
- },
- 4: {
- s: 1,
- m: '2',
- },
- 5: {
- s: 1,
- m: '2',
- v: 3,
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 2,
- endColumn: 5,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.LEFT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 2,
- endColumn: 2,
- });
- }
-});
-
-test('Test getNextDataRange:right1.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: 1,
- m: '2',
- },
- 3: {
- s: 1,
- m: '2',
- },
- 4: {
- s: '1',
- v: 2,
- m: '2',
- },
- 5: {
- s: 1,
- m: '2',
- v: 3,
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 2,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.RIGHT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 4,
- });
- }
-});
-
-test('Test getNextDataRange:right1.2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: 1,
- m: '2',
- },
- 3: {
- s: 1,
- m: '2',
- },
- 4: {
- s: 1,
- m: '2',
- },
- 5: {
- s: 1,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().columnCount = 5;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 2,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.RIGHT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 5,
- });
- }
-});
-test('Test getNextDataRange:right2.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: 1,
- m: '2',
- v: 2,
- },
- 3: {
- s: 1,
- m: '2',
- v: 2,
- },
- 4: {
- s: 1,
- m: '2',
- },
- 5: {
- s: 1,
- m: '2',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().columnCount = 5;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 2,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.RIGHT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 3,
- });
- }
-});
-test('Test getNextDataRange:right2.2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: 1,
- m: '2',
- v: 2,
- },
- 3: {
- s: 1,
- m: '2',
- v: 2,
- },
- 4: {
- s: 1,
- m: '2',
- v: 2,
- },
- 5: {
- s: 1,
- m: '2',
- v: 2,
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().columnCount = 5;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 2,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.RIGHT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 5,
- });
- }
-});
-test('Test getNextDataRange:right3.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: 1,
- m: '2',
- v: 2,
- },
- 3: {
- s: 1,
- m: '2',
- v: 2,
- },
- 4: {
- s: 1,
- m: '2',
- v: 2,
- },
- 5: {
- s: 1,
- m: '2',
- v: 2,
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().columnCount = 5;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 4,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 0,
- endRow: 0,
- startColumn: 3,
- endColumn: 3,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.RIGHT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 1,
- endColumn: 4,
- });
- }
-});
-test('Test getNextDataRange:right3.2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: 1,
- m: '1',
- },
- 1: {
- s: 1,
- m: '2',
- },
- 2: {
- s: 1,
- m: '2',
- },
- 3: {
- s: 1,
- m: '2',
- v: 2,
- },
- 4: {
- s: 1,
- m: '2',
- v: 2,
- },
- 5: {
- s: 1,
- m: '2',
- v: 2,
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().columnCount = 5;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 4,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 0,
- endRow: 0,
- startColumn: 3,
- endColumn: 3,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.RIGHT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 3,
- endColumn: 4,
- });
- }
-});
-
-test('Test getNextDataRange:right4.1', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: 1,
- m: '1',
- v: 1,
- },
- 1: {
- s: 1,
- m: '2',
- v: 2,
- },
- 2: {
- s: 1,
- m: '2',
- },
- 3: {
- s: 1,
- m: '2',
- v: 2,
- },
- 4: {
- s: 1,
- m: '2',
- v: 2,
- },
- 5: {
- s: 1,
- m: '2',
- v: 2,
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().columnCount = 5;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 4,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 0,
- endRow: 0,
- startColumn: 3,
- endColumn: 3,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.RIGHT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 1,
- endColumn: 4,
- });
- }
-});
-test('Test getNextDataRange:right4.2', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: 1,
- m: '1',
- v: 1,
- },
- 1: {
- s: 1,
- m: '2',
- v: 2,
- },
- 2: {
- s: 1,
- m: '2',
- v: 1,
- },
- 3: {
- s: 1,
- m: '2',
- v: 2,
- },
- 4: {
- s: 1,
- m: '2',
- v: 2,
- },
- 5: {
- s: 1,
- m: '2',
- v: 2,
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- worksheet.getConfig().columnCount = 5;
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const rangeData = {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 4,
- };
-
- worksheet.getSelection().setSelection({
- selection: rangeData,
- cell: {
- startRow: 0,
- endRow: 0,
- startColumn: 3,
- endColumn: 3,
- },
- });
- const activeRange = worksheet.getSelection().getNextDataRange(Direction.RIGHT);
- if (activeRange) {
- expect(activeRange.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 3,
- endColumn: 4,
- });
- }
-});
diff --git a/packages/core/test/Domain/Styles.test.ts b/packages/core/test/Domain/Styles.test.ts
deleted file mode 100644
index 0b04745c02..0000000000
--- a/packages/core/test/Domain/Styles.test.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-import { nanoid } from 'nanoid';
-import { Styles } from '../../src';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Test Styles', () => {
- const styles = new Styles({
- 1: {
- cl: {
- rgb: 'red',
- },
- },
- });
- const index = styles.setValue({
- cl: {
- rgb: 'blue',
- },
- });
- styles.setValue({
- cl: {
- rgb: 'green',
- },
- });
- expect(styles.get(index)).toEqual({
- cl: {
- rgb: 'blue',
- },
- });
-});
-
-test('Test each', () => {
- const map = {
- [nanoid(6)]: { cl: { rgb: 'red' } },
- };
- const styles = new Styles(map);
- styles.each(([id, val]) => {
- if (val && val.cl) {
- expect(val.cl.rgb).toEqual('red');
- }
- });
-});
-
-test('Test search', () => {
- const map = {
- [nanoid(6)]: { cl: { rgb: 'red' } },
- };
- const styles = new Styles(map);
- const find = styles.search({ cl: { rgb: 'red' } });
- expect(find).not.toBeUndefined();
-});
-
-test('Test get', () => {
- const map = {
- [nanoid(6)]: { cl: { rgb: 'red' } },
- };
- const styles = new Styles(map);
- // const find1 = styles.get({ cl: { rgb: 'red' } });
- // expect(find1).not.toBeUndefined();
- const find2 = styles.get('0');
- expect(find2).not.toBeUndefined();
-});
-
-test('Test add', () => {
- const map = {};
- const styles = new Styles(map);
-
- styles.add({ cl: { rgb: 'red' } });
- styles.add({ tr: { a: 10 } });
-
- const find1 = styles.search({ cl: { rgb: 'red' } });
- expect(find1).not.toBeUndefined();
-
- const find2 = styles.search({ tr: { a: 10 } });
- expect(find2).not.toBeUndefined();
-});
-
-test('Test setValue', () => {
- const map = {};
- const styles = new Styles(map);
- styles.add({ cl: { rgb: 'red' } });
- styles.add({ tr: { a: 10 } });
-
- const result1 = styles.setValue({ tr: { a: 20 } });
- expect(result1).not.toBeUndefined();
-
- const result2 = styles.setValue();
- expect(result2).toBeUndefined();
-});
diff --git a/packages/core/test/Domain/WorkBook.test.ts b/packages/core/test/Domain/WorkBook.test.ts
deleted file mode 100644
index 4162acf2d9..0000000000
--- a/packages/core/test/Domain/WorkBook.test.ts
+++ /dev/null
@@ -1,995 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { CommandManager, ServerHttp } from '../../src';
-import { SheetContext } from '../../src/Basics/SheetContext';
-import { Range } from '../../src/Sheets/Domain/Range';
-import { Workbook } from '../../src/Sheets/Domain/Workbook';
-import { Worksheet } from '../../src/Sheets/Domain/Worksheet';
-import { BooleanNumber } from '../../src/Types/Enum';
-import { createCoreTestContainer } from './Range.test';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Test _getDefaultWorkSheet', () => {
- const container = createCoreTestContainer({
- sheets: { sheet1: { id: 'sheet1' }, sheet2: { id: 'sheet2' } },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- expect(workbook.getSheets().length).toEqual(2);
-});
-
-test('Test _setServerBase', () => {
- const container = createCoreTestContainer({
- sheets: { sheet1: { id: 'sheet1' }, sheet2: { id: 'sheet2' } },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- workbook.setServerBase(new ServerHttp());
- expect(workbook.getServer()).not.toBeUndefined();
-});
-
-test('Test setDefaultActiveSheet', () => {
- const container = createCoreTestContainer({
- sheets: { sheet1: { id: 'sheet1' }, sheet2: { id: 'sheet2' } },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- workbook.setDefaultActiveSheet();
- expect(workbook.getSheets()[0].getStatus()).toEqual(BooleanNumber.TRUE);
-});
-
-test('Test setContext', () => {
- const container = createCoreTestContainer({
- sheets: { sheet1: { id: 'sheet1' }, sheet2: { id: 'sheet2' } },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- workbook.setContext(context);
- expect(workbook.getContext()).toBe(context);
-});
-
-test('Test setCommandManager', () => {
- const container = createCoreTestContainer({
- sheets: { sheet1: { id: 'sheet1' }, sheet2: { id: 'sheet2' } },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const manager = container.getSingleton<CommandManager>('CommandManager');
- workbook.setCommandManager(manager);
- expect(workbook.getCommandManager()).toBe(manager);
-});
-
-test('Test flush', () => {
- const container = createCoreTestContainer({});
- const workbook = container.getSingleton<Workbook>('WorkBook');
- workbook.flush();
-});
-
-test('Test activateSheet', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet-01',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: BooleanNumber.TRUE,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const secondConfigure = {
- id: 'sheet-02',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: BooleanNumber.FALSE,
- };
- const secondWorksheet = new Worksheet(context, secondConfigure);
- workbook.insertSheet(secondWorksheet);
- secondWorksheet.setCommandManager(commandManager);
-
- // activate sheet
- workbook.setActiveSheet(secondWorksheet);
-
- // test current sheet status state
- const currentStatus = secondWorksheet.getStatus();
- expect(currentStatus).toEqual(BooleanNumber.TRUE);
-
- // undo
- secondWorksheet.getCommandManager().undo();
-
- // test previous sheet status state
- const preStatus = secondWorksheet.getStatus();
- expect(preStatus).toEqual(BooleanNumber.FALSE);
-});
-
-test('Test setActiveRange', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- const commandManager = workbook.getCommandManager();
- workbook.setContext(context);
-
- const secondConfigure = {
- id: 'sheet-02',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const oneWorksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- secondConfigure
- );
- oneWorksheet.setCommandManager(commandManager);
- workbook.insertSheet(oneWorksheet);
-
- const range = oneWorksheet.getRange({
- startRow: 0,
- startColumn: 0,
- endRow: 10,
- endColumn: 10,
- });
-
- workbook.setActiveRange(range);
- const activeRange1 = workbook.getActiveRange();
- expect(activeRange1 as Range).toEqual(null);
-
- workbook.setActiveSheet(oneWorksheet);
- workbook.setActiveRange(range);
- const activeRange2 = workbook.getActiveRange();
- expect((activeRange2 as Range).getRangeData()).toEqual(range.getRangeData());
-});
-
-test('Test getIndexBySheetId', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- const commandManager = workbook.getCommandManager();
- workbook.setContext(context);
-
- const secondConfigure = {
- id: 'sheet-02',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const oneWorksheet = new Worksheet(context, secondConfigure);
- oneWorksheet.setCommandManager(commandManager);
- workbook.insertSheet(oneWorksheet);
-
- expect(workbook.getIndexBySheetId('sheet-02')).toEqual(0);
-});
-
-test('Test insertSheet', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- const commandManager = workbook.getCommandManager();
- workbook.setContext(context);
-
- const oneConfigure = {
- id: 'sheet-02',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const oneWorksheet = new Worksheet(context, oneConfigure);
- oneWorksheet.setCommandManager(commandManager);
- workbook.insertSheet(oneWorksheet);
-
- expect(workbook.getCommandManager()).not.toEqual(null);
- expect(workbook.getContext()).not.toEqual(null);
- expect(workbook.getSheets().length).toEqual(1);
- expect(workbook.getActiveSpreadsheet()).toEqual(workbook);
-
- workbook.create('Test1');
- expect(workbook.getSheets().length).toEqual(2);
-
- workbook.insertSheet(1);
- expect(workbook.getSheets().length).toEqual(3);
-
- workbook.insertSheet('sheet2');
- expect(workbook.getSheets().length).toEqual(4);
-
- workbook.insertSheet({ name: 'sheet3' });
- expect(workbook.getSheets().length).toEqual(5);
-
- workbook.insertSheet('sheet4', 1);
- expect(workbook.getSheets().length).toEqual(6);
-
- workbook.insertSheet(1, { name: 'sheet5' });
- expect(workbook.getSheets().length).toEqual(7);
-
- const twoConfigure = {
- id: 'sheet6',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const towWorksheet = new Worksheet(context, twoConfigure);
- oneWorksheet.setCommandManager(commandManager);
-
- workbook.insertSheet(1, towWorksheet);
- expect(workbook.getSheets().length).toEqual(8);
-});
-
-test('Test create', () => {
- const container = createCoreTestContainer({});
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const worksheet = workbook.create('sheet1', 100, 100);
- expect(worksheet).not.toBeUndefined();
-});
-
-test('Test getActiveRangeList', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- const commandManager = workbook.getCommandManager();
- workbook.setContext(context);
-
- const secondConfigure = {
- id: 'sheet-02',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const oneWorksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- secondConfigure
- );
- oneWorksheet.setCommandManager(commandManager);
- workbook.insertSheet(oneWorksheet);
-
- expect(workbook.getActiveRangeList()).toBe(null);
- workbook.setDefaultActiveSheet();
- expect(workbook.getActiveRangeList()).toBe(
- oneWorksheet.getSelection().getActiveRangeList()
- );
-});
-
-test('Test getSelection', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- workbook.setContext(context);
- expect(workbook.getSelection()).not.toEqual(null);
-});
-
-test('Test getCurrentCell', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
- const context = container.getSingleton<SheetContext>('Context');
- workbook.setContext(context);
-
- const secondConfigure = {
- id: 'sheet-02',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- secondConfigure
- );
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- workbook.setActiveSheet(worksheet);
-
- const cell = worksheet.getRange({
- startRow: 10,
- startColumn: 10,
- endRow: 10,
- endColumn: 10,
- });
- workbook.setCurrentCell(cell);
-
- expect((workbook.getCurrentCell() as Range).getRangeData()).toEqual(
- cell.getRangeData()
- );
-});
-
-test('Test setSheetOrder', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
- const context = container.getSingleton<SheetContext>('Context');
- workbook.setContext(context);
-
- const secondConfigure = {
- id: 'sheet-02',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- secondConfigure
- );
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- workbook.setActiveSheet(worksheet);
- workbook.setSheetOrder('sheet-02', 3);
-
- expect(workbook.getSheets()[3]).toEqual(worksheet);
-});
-
-test('Test removeSheetBySheetId', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
- const context = container.getSingleton<SheetContext>('Context');
- workbook.setContext(context);
-
- const secondConfigure = {
- id: 'sheet-02',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- secondConfigure
- );
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- workbook.setActiveSheet(worksheet);
-
- expect(workbook.getSheets().length).toEqual(1);
- workbook.removeSheetBySheetId('sheet-02');
- expect(workbook.getSheets().length).toEqual(0);
-});
-
-test('Test getSheetBySheetName', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
- const context = container.getSingleton<SheetContext>('Context');
- workbook.setContext(context);
-
- const secondConfigure = {
- id: 'sheet-02',
- name: 'sheet-luck',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- secondConfigure
- );
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- workbook.setActiveSheet(worksheet);
-
- const find = workbook.getSheetBySheetName('sheet-luck');
- expect(worksheet).toEqual(find);
-});
-
-// test('Test newFilterCriteria', () => {
-// const container = IOCContainerStartUpReady({
-// styles: {
-// 1: {
-// cl: {
-// rgb: 'blue',
-// },
-// },
-// 2: {
-// cl: {
-// rgb: 'red',
-// },
-// },
-// },
-// });
-// const workbook = container.getSingleton<WorkBook>('WorkBook');
-// const commandManager = workbook.getCommandManager();
-// const context = container.getSingleton<SheetContext>('SheetContext');
-// workbook.setContext(context);
-
-// const secondConfigure = {
-// id: 'sheet-02',
-// name: 'sheet-luck',
-// cellData: {
-// 0: {
-// 0: {
-// s: 1,
-// v: 1,
-// m: '1',
-// },
-// },
-// },
-// status: 0,
-// };
-// const worksheet = container.getInstance<WorkSheet>(
-// 'WorkSheet',
-// context,
-// secondConfigure
-// );
-// worksheet.setCommandManager(commandManager);
-// workbook.insertSheet(worksheet);
-// workbook.setActiveSheet(worksheet);
-
-// const filterCriteria = workbook.newFilterCriteria();
-// expect(filterCriteria).not.toBeNull();
-// });
-
-test('Test setActiveRangeList', () => {
- const container = createCoreTestContainer({
- sheets: { sheet1: { id: 'sheet1' }, sheet2: { id: 'sheet2' } },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- workbook.setActiveRangeList([
- { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 },
- { startRow: 3, startColumn: 3, endRow: 4, endColumn: 4 },
- ]);
- workbook.setDefaultActiveSheet();
- workbook.setActiveRangeList([
- { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 },
- { startRow: 3, startColumn: 3, endRow: 4, endColumn: 4 },
- ]);
-});
-
-test('Test getSheetBySheetId', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
- const context = container.getSingleton<SheetContext>('Context');
- workbook.setContext(context);
-
- const secondConfigure = {
- id: 'sheet-02',
- name: 'sheet-luck',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- secondConfigure
- );
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- workbook.setActiveSheet(worksheet);
-
- const find = workbook.getSheetBySheetId('sheet-02');
- expect(worksheet).toEqual(find);
-});
-
-test('Test setActiveSheet', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
- const context = container.getSingleton<SheetContext>('Context');
- workbook.setContext(context);
-
- const secondConfigure = {
- id: 'sheet-02',
- name: 'sheet-luck',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- secondConfigure
- );
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- workbook.setActiveSheet(worksheet);
-
- expect(workbook.getActiveSheet()).toEqual(worksheet);
-});
-
-// test('Test getFormatManager', () => {
-// const container = IOCContainerStartUpReady({
-// styles: {
-// 1: {
-// cl: {
-// rgb: 'blue',
-// },
-// },
-// 2: {
-// cl: {
-// rgb: 'red',
-// },
-// },
-// },
-// });
-// const workbook = container.getSingleton<WorkBook>('WorkBook');
-// const commandManager = workbook.getCommandManager();
-// const context = container.getSingleton<SheetContext>('SheetContext');
-// workbook.setContext(context);
-
-// const secondConfigure = {
-// id: 'sheet-02',
-// name: 'sheet-luck',
-// cellData: {
-// 0: {
-// 0: {
-// s: 1,
-// v: 1,
-// m: '1',
-// },
-// },
-// },
-// status: 0,
-// };
-// const worksheet = container.getInstance<WorkSheet>(
-// 'WorkSheet',
-// context,
-// secondConfigure
-// );
-// worksheet.setCommandManager(commandManager);
-// workbook.insertSheet(worksheet);
-// workbook.setActiveSheet(worksheet);
-
-// const formatManager = workbook.getFormatManager();
-// expect(formatManager).not.toBeNull();
-// });
-
-// test('Test newConditionalFormatRule', () => {
-// const container = IOCContainerStartUpReady({
-// styles: {
-// 1: {
-// cl: {
-// rgb: 'blue',
-// },
-// },
-// 2: {
-// cl: {
-// rgb: 'red',
-// },
-// },
-// },
-// });
-// const workbook = container.getSingleton<WorkBook>('WorkBook');
-// const commandManager = workbook.getCommandManager();
-// const context = container.getSingleton<SheetContext>('SheetContext');
-// workbook.setContext(context);
-
-// const secondConfigure = {
-// id: 'sheet-02',
-// name: 'sheet-luck',
-// cellData: {
-// 0: {
-// 0: {
-// s: 1,
-// v: 1,
-// m: '1',
-// },
-// },
-// },
-// status: 0,
-// };
-// const worksheet = container.getInstance<WorkSheet>(
-// 'WorkSheet',
-// context,
-// secondConfigure
-// );
-// worksheet.setCommandManager(commandManager);
-// workbook.insertSheet(worksheet);
-// workbook.setActiveSheet(worksheet);
-
-// const conditionalFormatRule = workbook.newConditionalFormatRule();
-// expect(conditionalFormatRule).not.toBeNull();
-// });
-
-test('Test getCommandManager', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
- const context = container.getSingleton<SheetContext>('Context');
- workbook.setContext(context);
-
- const secondConfigure = {
- id: 'sheet-02',
- name: 'sheet-luck',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- secondConfigure
- );
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- workbook.setActiveSheet(worksheet);
-
- expect(workbook.getCommandManager()).not.toBeNull();
-});
-
-// test('Test newFilterCriteria', () => {
-// const container = IOCContainerStartUpReady({
-// sheets: [{ id: 'sheet1' }, { id: 'sheet2' }],
-// });
-// const workbook = container.getSingleton<WorkBook>('WorkBook');
-// workbook.setPluginMeta('test', {});
-// expect(workbook.newFilterCriteria()).not.toBeUndefined();
-// });
-
-test('Test getPluginMeta/setPluginMeta', () => {
- const container = createCoreTestContainer({
- sheets: { sheet1: { id: 'sheet1' }, sheet2: { id: 'sheet2' } },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- workbook.setPluginMeta('test', {});
- expect(workbook.getPluginMeta('test')).not.toBeUndefined();
-});
-
-// test('Test newConditionalFormatRule', () => {
-// const container = IOCContainerStartUpReady({
-// sheets: [{ id: 'sheet1' }, { id: 'sheet2' }],
-// });
-// const workbook = container.getSingleton<WorkBook>('WorkBook');
-// workbook.setPluginMeta('test', {});
-// expect(workbook.newConditionalFormatRule()).not.toBeUndefined();
-// });
-
-test('Test getConfig', () => {
- const container = createCoreTestContainer({
- sheets: { sheet1: { id: 'sheet1' }, sheet2: { id: 'sheet2' } },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- expect(workbook.getConfig()).not.toBeUndefined();
-});
-
-test('Test setActiveSheet', () => {
- const container = createCoreTestContainer({
- sheets: { sheet1: { id: 'sheet1' }, sheet2: { id: 'sheet2' } },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
- const context = container.getSingleton<SheetContext>('Context');
-
- const secondConfigure = {
- id: 'sheet-02',
- name: 'sheet-luck',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- secondConfigure
- );
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- workbook.setActiveSheet(worksheet, true);
-});
-
-test('Test setSheetOrder', () => {
- const container = createCoreTestContainer({
- sheets: { sheet1: { id: 'sheet1' }, sheet2: { id: 'sheet2' } },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- workbook.setSheetOrder('sheet1', 1);
-});
-
-test('Test isIRangeType', () => {
- const rangeData = { startRow: 1, endRow: 1, startColumn: 1, endColumn: 1 };
- expect(Workbook.isIRangeType(rangeData)).toEqual(true);
-});
-
-test('Test rangeDataToRangeStringData', () => {
- const rangeData = { startRow: 1, endRow: 1, startColumn: 1, endColumn: 1 };
- expect(Workbook.rangeDataToRangeStringData(rangeData)).toEqual('B2:B2');
-});
-
-test('Test rangeDataToRangeStringData', () => {
- const container = createCoreTestContainer({
- sheets: {
- sheet1: {
- id: 'sheet1',
- status: BooleanNumber.TRUE,
- rowCount: 30,
- columnCount: 10,
- },
- },
- });
- const workbook = container.getSingleton<Workbook>('WorkBook');
- expect(workbook.transformRangeType('A1:B1').rangeData).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 1,
- });
- expect(workbook.transformRangeType('Sheet2!A1:B1').sheetId).toEqual('Sheet2');
- expect(workbook.transformRangeType('A:A').rangeData).toEqual({
- startRow: 0,
- endRow: 30,
- startColumn: 0,
- endColumn: 0,
- });
- expect(workbook.transformRangeType('1:1').rangeData).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 10,
- });
-});
diff --git a/packages/core/test/Domain/WorkSheet.test.ts b/packages/core/test/Domain/WorkSheet.test.ts
deleted file mode 100644
index e770cfca79..0000000000
--- a/packages/core/test/Domain/WorkSheet.test.ts
+++ /dev/null
@@ -1,3564 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { BooleanNumber, Range } from '../../src';
-import { SheetContext } from '../../src/Basics/SheetContext';
-import { Workbook } from '../../src/Sheets/Domain/Workbook';
-import { Worksheet } from '../../src/Sheets/Domain/Worksheet';
-import { createCoreTestContainer } from './Range.test';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Test activate', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- },
- 2: {
- cl: {
- rgb: 'red',
- },
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet-01',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const test = new Worksheet(context);
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const secondConfigure = {
- id: 'sheet-02',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const secondWorksheet = new Worksheet(context, secondConfigure);
- workbook.insertSheet(secondWorksheet);
- secondWorksheet.setCommandManager(commandManager);
- expect(secondWorksheet.getSheetId()).toEqual('sheet-02');
-
- // activate sheet
- secondWorksheet.activate();
-
- // test current sheet status state
- const currentStatus = secondWorksheet.getStatus();
- expect(currentStatus).toEqual(BooleanNumber.TRUE);
-
- // undo
- secondWorksheet.getCommandManager().undo();
-
- // test previous sheet status state
- const preStatus = secondWorksheet.getStatus();
- expect(preStatus).toEqual(BooleanNumber.FALSE);
-
- // redo
- secondWorksheet.getCommandManager().redo();
-
- // test next sheet status state
- const nextStatus = secondWorksheet.getStatus();
- expect(nextStatus).toEqual(BooleanNumber.TRUE);
- secondWorksheet.activate();
-});
-
-test('Test getCellMatrix', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- 3: {},
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- expect(worksheet.getCellMatrix()).not.toBeUndefined();
-});
-
-test('Test clone', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const worksheet = new Worksheet(context, { id: sheetId });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- expect(worksheet.clone()).not.toBeUndefined();
-});
-
-test('Test SetName', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const sheetName = 'sheet';
- const worksheet = new Worksheet(context, { id: sheetId, name: sheetName });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- expect(worksheet.getName()).toEqual('sheet');
-
- worksheet.setName('luckSheet');
- expect(worksheet.getName()).toEqual('luckSheet');
-});
-
-test('Test setStatus', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const sheetName = 'sheet';
- const worksheet = new Worksheet(context, { id: sheetId, name: sheetName });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- worksheet.setStatus(BooleanNumber.FALSE);
- expect(worksheet.getStatus()).toEqual(BooleanNumber.FALSE);
-});
-
-test('Test Clear', () => {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- cl: {
- rgb: 'blue',
- },
- fs: 12,
- },
- },
- });
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 3,
- m: '3',
- },
- 1: {
- s: '1',
- v: 4,
- m: '4',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- // clear sheet
- worksheet.clear();
- worksheet.clear({
- formatOnly: true,
- });
-
- // test current sheet
- const currentV = worksheet.getCellMatrix().getData();
- expect(currentV).toEqual({
- 0: {
- 0: {
- v: '',
- m: '',
- },
- 1: {
- v: '',
- m: '',
- },
- },
- 1: {
- 0: {
- v: '',
- m: '',
- },
- 1: {
- v: '',
- m: '',
- },
- },
- });
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous A1 color
- const preV = worksheet.getCellMatrix()?.getData();
- // expect(preV).toEqual({
- // 0: {
- // 0: {
- // s: '1',
- // v: 1,
- // m: '1',
- // },
- // 1: {
- // s: '1',
- // v: 2,
- // m: '2',
- // },
- // },
- // 1: {
- // 0: {
- // s: '1',
- // v: 3,
- // m: '3',
- // },
- // 1: {
- // s: '1',
- // v: 4,
- // m: '4',
- // },
- // },
- // });
-});
-
-test('Test SetTabColor', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const worksheet = new Worksheet(context, { id: sheetId, tabColor: 'red' });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- // clear sheet
- worksheet.setTabColor('blue');
-
- // test current sheet tab color
- const currentTabColor = worksheet.getConfig().tabColor;
- expect(currentTabColor).toEqual('blue');
-
- // undo
- worksheet.getCommandManager().undo();
-
- // test previous sheet tab color
- const preTabColor = worksheet.getConfig().tabColor;
- expect(preTabColor).toEqual('red');
-
- // redo
- worksheet.getCommandManager().redo();
-
- // test next sheet tab color
- const nextTabColor = worksheet.getConfig().tabColor;
- expect(nextTabColor).toEqual('blue');
-});
-
-test('Test ClearContents', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const cellData = { 0: { 0: { v: 'lucksheet', m: 'lucksheet' } } };
- const worksheet = new Worksheet(context, { id: sheetId, cellData });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- const cellMatrix = worksheet.getCellMatrix();
- const cell = cellMatrix.getValue(0, 0);
- if (cell) {
- expect(cell.v).toEqual('lucksheet');
- worksheet.clearContents();
- expect(cell.v).toEqual('');
- }
-});
-
-test('Test ClearNotes', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const cellData = { 0: { 0: { v: 'lucksheet', m: 'lucksheet' } } };
- const worksheet = new Worksheet(context, { id: sheetId, cellData });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- const cellMatrix = worksheet.getCellMatrix();
- const cell = cellMatrix.getValue(0, 0);
- if (cell) {
- expect(cell.v).toEqual('lucksheet');
- worksheet.clearNotes();
- }
-});
-
-test('Test ClearFormats', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const cellData = { 0: { 0: { v: 'lucksheet', m: 'lucksheet' } } };
- const worksheet = new Worksheet(context, { id: sheetId, cellData });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- const cellMatrix = worksheet.getCellMatrix();
- const cell = cellMatrix.getValue(0, 0);
- if (cell) {
- expect(cell.v).toEqual('lucksheet');
- worksheet.clearFormats();
- }
-});
-
-test('Test DeleteRow', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const cellData = {
- 0: {
- 0: { v: 'lucksheet1', m: 'lucksheet1' },
- 1: { v: 'lucksheet1', m: 'lucksheet1' },
- 2: { v: 'lucksheet1', m: 'lucksheet1' },
- },
- 1: {
- 0: { v: 'lucksheet1', m: 'lucksheet1' },
- 1: { v: 'lucksheet1', m: 'lucksheet1' },
- 2: { v: 'lucksheet1', m: 'lucksheet1' },
- },
- 2: {
- 0: { v: 'lucksheet1', m: 'lucksheet1' },
- 1: { v: 'lucksheet1', m: 'lucksheet1' },
- 2: { v: 'lucksheet1', m: 'lucksheet1' },
- },
- 3: {
- 0: { v: 'lucksheet1', m: 'lucksheet1' },
- 1: { v: 'lucksheet1', m: 'lucksheet1' },
- 2: { v: 'lucksheet1', m: 'lucksheet1' },
- },
- };
- const rowData = {
- 0: { hd: 0, h: 10 },
- 1: { hd: 0, h: 10 },
- 2: { hd: 0, h: 10 },
- 3: { hd: 0, h: 10 },
- };
- const configure = { sheetId, cellData, rowData };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- worksheet.deleteRow(1);
- worksheet.deleteRows(1, 1);
-});
-
-test('Test SetCurrentCell/getActiveCell/getActiveRangeList', () => {
- const container = createCoreTestContainer();
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- configure
- );
- worksheet.setCommandManager(commandManager);
- worksheet.setCurrentCell(
- new Range(worksheet, {
- startRow: 0,
- endRow: 1,
- startColumn: 0,
- endColumn: 1,
- })
- );
- expect(worksheet.getActiveCell().getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 0,
- });
- expect(worksheet.getActiveRangeList().getRangeList().length).toEqual(1);
-});
-
-// test('Test BorderStyle', () => {
-// const container = IOCContainerStartUpReady();
-// const context = container.getSingleton<SheetContext>('SheetContext');
-// const workbook = container.getSingleton<WorkBook>('WorkBook');
-// const commandManager = workbook.getCommandManager();
-
-// const configure = {
-// id: 'sheet',
-// cellData: {
-// 0: {
-// 0: {
-// s: '1',
-// v: 1,
-// m: '1',
-// },
-// 1: {
-// s: '1',
-// v: 2,
-// m: '2',
-// },
-// },
-// 1: {
-// 0: {
-// s: '1',
-// v: 3,
-// m: '3',
-// },
-// 1: {
-// s: '1',
-// v: 4,
-// m: '4',
-// },
-// },
-// },
-// status: 1,
-// };
-// const worksheet = new WorkSheet(context, configure);
-// workbook.insertSheet(worksheet);
-// worksheet.setCommandManager(commandManager);
-// const borderStyles = worksheet.getBorderStyles();
-
-// // console.log(JSON.stringify(workbook.getStyles()));
-// borderStyles.setRStyle(0, 0, {
-// cl: { rgb: 'rgb(0,0,0,)' },
-// s: BorderStyleTypes.DASH_DOT,
-// });
-// // console.log(JSON.stringify(workbook.getStyles()));
-// borderStyles.setLStyle(0, 1, {
-// cl: { rgb: 'rgb(0,0,0,)' },
-// s: BorderStyleTypes.DASH_DOT,
-// });
-// // console.log(JSON.stringify(workbook.getStyles()));
-// });
-
-test('Test Copy', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const worksheet = new Worksheet(context, { id: sheetId });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- expect(worksheet.copy('demo')).not.toBeUndefined();
-});
-
-test('Test getRange', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- configure
- );
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const a = worksheet
- .getRange({
- startRow: 1,
- endRow: 1,
- startColumn: 1,
- endColumn: 1,
- })
- .getRangeData();
-
- const b = worksheet.getRange(1, 1).getRangeData();
- const c = worksheet.getRange(1, 1, 2).getRangeData();
- const d = worksheet.getRange('A1:B1').getRangeData();
-
- expect(a).toEqual({
- startRow: 1,
- endRow: 1,
- startColumn: 1,
- endColumn: 1,
- });
- expect(b).toEqual({
- startRow: 1,
- endRow: 1,
- startColumn: 1,
- endColumn: 1,
- });
- expect(c).toEqual({
- startRow: 1,
- endRow: 2,
- startColumn: 1,
- endColumn: 1,
- });
- expect(d).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 1,
- });
-});
-
-test('Test getRangeList', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const a = worksheet.getRangeList(['A1:B1', 'A2:B2']).getRangeList();
- // console.log(a);
-});
-
-test('Test getStatus/setStatus', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const sheetName = 'sheet';
- const worksheet = container.getInstance<Worksheet>('WorkSheet', context, {
- sheetId,
- name: sheetName,
- });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- expect(worksheet.getStatus()).toEqual(BooleanNumber.FALSE);
- worksheet.setStatus(BooleanNumber.TRUE);
- expect(worksheet.getStatus()).toEqual(BooleanNumber.TRUE);
-});
-
-test('Test hideSheet/showSheet', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const worksheet = new Worksheet(context, { id: sheetId });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- // hide sheet
- worksheet.hideSheet();
-
- // test current sheet hidden state
- const currentHidden = worksheet.getConfig().hidden;
- expect(currentHidden).toEqual(1);
-
- worksheet.showSheet();
- const currentHidden1 = worksheet.getConfig().hidden;
- expect(currentHidden1).toEqual(0);
- const sheetId1 = 'sheet1';
- const worksheet1 = new Worksheet(context, { id: sheetId1, hidden: 1 });
- worksheet1.setCommandManager(commandManager);
- workbook.insertSheet(worksheet1);
- worksheet1.hideSheet();
- const sheetId2 = 'sheet2';
- const worksheet2 = new Worksheet(context, { id: sheetId2, hidden: 0 });
- worksheet2.setCommandManager(commandManager);
- workbook.insertSheet(worksheet2);
- worksheet2.showSheet();
-});
-
-test('Test hideRow/hideRows', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
- worksheet.hideRows(2, 1);
- worksheet.hideRow(
- new Range(worksheet, {
- startRow: 0,
- startColumn: 0,
- endRow: 0,
- endColumn: 0,
- })
- );
-});
-
-test('Test showColumns/hideColumns', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- '2': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
- worksheet.hideColumn(
- new Range(worksheet, {
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 0,
- })
- );
- expect(worksheet.getConfig().columnData['0'].hd).toEqual(true);
- worksheet.hideColumns(0, 1);
- expect(worksheet.getConfig().columnData['0'].hd).toEqual(true);
- worksheet.showColumns(0, 1);
- expect(worksheet.getConfig().columnData['0'].hd).toEqual(false);
-});
-
-test('Test showRows/hideRows', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
- worksheet.hideRows(1, 1);
- worksheet.showRows(1, 1);
-});
-
-test('Test unhideRow/unhideColumn', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
- worksheet.hideRows(1, 1);
- const range = worksheet.getRange('A1:A2');
- worksheet.unhideRow(range);
- worksheet.hideColumns(1, 1);
- const range1 = worksheet.getRange('A1:B1');
- worksheet.unhideColumn(range1);
-});
-
-test('Test hasHiddenGridlines/setHiddenGridlines', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const worksheet = new Worksheet(context, { id: sheetId });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- // hide sheet
- worksheet.setHiddenGridlines(true);
- expect(worksheet.hasHiddenGridlines()).toEqual(true);
- worksheet.getCommandManager().undo();
- expect(worksheet.hasHiddenGridlines()).toEqual(false);
- worksheet.getCommandManager().redo();
- expect(worksheet.hasHiddenGridlines()).toEqual(true);
-});
-
-test('Test getTabColor', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- // hide sheet
- expect(worksheet.getTabColor()).toEqual('red');
-});
-
-test('Test setColumnWidth/getColumnWidth', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- worksheet.setColumnWidth(0, 1, 50);
- expect(worksheet.getColumnWidth(0)).toEqual(50);
- expect(worksheet.getColumnManager().getColumnWidth(0, 2)).toEqual(250);
- expect(worksheet.getColumnManager().getSize()).toEqual(2);
- expect(worksheet.getColumnManager().getColumnData().getSizeOf()).toEqual(2);
- worksheet.getCommandManager().undo();
- expect(worksheet.getColumnWidth(0)).toEqual(100);
- worksheet.getCommandManager().redo();
- expect(worksheet.getColumnWidth(0)).toEqual(50);
- worksheet.setColumnWidth(0, 30);
- expect(worksheet.getColumnWidth(0)).toEqual(30);
-});
-
-test('Test setRowHeights/getRowHeight', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- worksheet.setRowHeights(0, 2, 30);
- expect(worksheet.getRowHeight(0)).toEqual(30);
- expect(worksheet.getRowHeight(1)).toEqual(30);
- expect(worksheet.getRowManager().getRowHeight(0, 2)).toEqual(60);
- worksheet.getCommandManager().undo();
- expect(worksheet.getRowHeight(0)).toEqual(50);
- expect(worksheet.getRowHeight(1)).toEqual(60);
- worksheet.getCommandManager().redo();
- expect(worksheet.getRowHeight(0)).toEqual(30);
- expect(worksheet.getRowHeight(1)).toEqual(30);
- worksheet.setRowHeight(0, 10);
- expect(worksheet.getRowHeight(0)).toEqual(10);
-});
-
-test('Test setActiveSelection', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- configure
- );
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- worksheet.setActiveSelection('A1:B1');
-});
-
-test('Test getFrozenRows/getFrozenColumns/getMaxColumns/getMaxRows/getType/getRowCount/getColumnCount', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- expect(worksheet.getFrozenColumns()).toEqual(-1);
- expect(worksheet.getFrozenRows()).toEqual(-1);
- expect(worksheet.getMaxColumns()).toEqual(100);
- expect(worksheet.getMaxRows()).toEqual(1000);
- expect(worksheet.getType()).toEqual(0);
- expect(worksheet.getRowCount()).toEqual(1000);
- expect(worksheet.getColumnCount()).toEqual(100);
-});
-
-// test('Test getBorderStyles/setBorderStyles', () => {
-// const container = IOCContainerStartUpReady();
-// const context = container.getSingleton<SheetContext>('SheetContext');
-// const workbook = container.getSingleton<WorkBook>('WorkBook');
-// const commandManager = workbook.getCommandManager();
-
-// const configure = {
-// id: 'sheet',
-// cellData: {
-// 0: {
-// 0: {
-// s: '1',
-// v: 1,
-// m: '1',
-// },
-// 1: {
-// s: '1',
-// v: 2,
-// m: '2',
-// },
-// 2: {
-// s: '1',
-// v: 3,
-// m: '3',
-// },
-// },
-// 1: {
-// 0: {
-// s: '1',
-// v: 4,
-// m: '4',
-// },
-// 1: {
-// s: '1',
-// v: 5,
-// m: '5',
-// },
-// 2: {
-// s: '1',
-// v: 6,
-// m: '6',
-// },
-// },
-// 2: {
-// 0: {
-// s: '1',
-// v: 7,
-// m: '7',
-// },
-// 1: {
-// s: '1',
-// v: 8,
-// m: '8',
-// },
-// 2: {
-// s: '1',
-// v: 9,
-// m: '9',
-// },
-// },
-// },
-// rowData: {
-// '0': {
-// h: 50,
-// hd: 0,
-// },
-// '1': {
-// h: 60,
-// hd: 1,
-// },
-// },
-// columnData: {
-// '0': {
-// w: 100,
-// hd: 0,
-// },
-// '1': {
-// w: 200,
-// hd: 1,
-// },
-// },
-// status: 1,
-// tabColor: 'red',
-// };
-// const worksheet = new WorkSheet(context, configure);
-// worksheet.setCommandManager(commandManager);
-// workbook.insertSheet(worksheet);
-// worksheet.setBorderStyle(
-// { startRow: 0, endRow: 1, startColumn: 0, endColumn: 1 },
-// { s: 0, cl: { rgb: 'red' } },
-// [1]
-// );
-// worksheet.getBorderStyles();
-// });
-
-test('Test getIndex/getParent', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const worksheet = new Worksheet(context, { id: sheetId });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- expect(worksheet.getIndex()).toEqual(1);
- worksheet.getParent();
-});
-
-test('Test isSheetHidden', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const worksheet = new Worksheet(context, { id: sheetId });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- expect(worksheet.isSheetHidden()).toEqual(0);
-});
-
-test('Test isRightToLeft/setRightToLeft', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const worksheet = new Worksheet(context, { id: sheetId });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- worksheet.setRightToLeft(BooleanNumber.TRUE);
- expect(worksheet.isRightToLeft()).toEqual(BooleanNumber.TRUE);
- worksheet.getCommandManager().undo();
- expect(worksheet.isRightToLeft()).toEqual(BooleanNumber.FALSE);
- worksheet.getCommandManager().redo();
- expect(worksheet.isRightToLeft()).toEqual(BooleanNumber.TRUE);
-});
-
-test('Test getPluginMeta/setPluginMeta', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const sheetId = 'sheet';
- const worksheet = new Worksheet(context, { id: sheetId });
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- worksheet.setPluginMeta('name', 'univer');
- expect(worksheet.getPluginMeta('name')).toEqual('univer');
-});
-
-test('Test getLastRow/getLastColumn', () => {
- const container = createCoreTestContainer();
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- configure
- );
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- worksheet.insertRows(3, 100);
- expect(worksheet.getLastRow()).toEqual(103);
-});
-
-test('Test copyTo', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet-01',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 1,
- };
- const worksheet = new Worksheet(context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- const secondConfigure = {
- id: 'sheet-02',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- },
- },
- status: 0,
- };
- const secondWorksheet = new Worksheet(context, secondConfigure);
- workbook.insertSheet(secondWorksheet);
- secondWorksheet.setCommandManager(commandManager);
- worksheet.copyTo(5);
- worksheet.copyTo(1);
- expect(secondWorksheet.getStatus()).toEqual(1);
-});
-
-test('Test getSheetValues', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- const values = worksheet.getSheetValues(1, 1, 2, 2);
-});
-
-test('Test getSheetValues', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
-
- const values = worksheet.getDataRange();
-});
-
-test('Test InsertRows', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- worksheet.insertRows(1);
- worksheet.insertRows(1, 1);
- worksheet.getCommandManager().undo();
- worksheet.getCommandManager().redo();
-});
-
-test('Test insertrowsafter/insertrowsbefore', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- worksheet.insertRowAfter(1);
- worksheet.insertRowAfter(1, 1);
-});
-
-test('Test insertrowsbefore', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- worksheet.insertRowBefore(1);
- worksheet.insertRowBefore(1, 1);
- worksheet.insertRowBefore(0);
-});
-
-test('Test moveRows', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- const range = worksheet.getRange('A1:B1');
- worksheet.moveRows(range, 2);
-});
-
-test('Test insertColumns', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- worksheet.insertColumns(1);
- expect(worksheet.getLastColumn()).toEqual(3);
- worksheet.getCommandManager().undo();
- worksheet.getCommandManager().redo();
- worksheet.insertColumns(1, 1);
- expect(worksheet.getLastColumn()).toEqual(4);
-});
-test('Test insertColumnsBefore', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- worksheet.insertColumnBefore(0);
- expect(worksheet.getLastColumn()).toEqual(3);
- worksheet.insertColumnBefore(1, 1);
- expect(worksheet.getLastColumn()).toEqual(4);
-});
-
-test('Test insertColumnsAfter', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- worksheet.insertColumnAfter(0);
- expect(worksheet.getLastColumn()).toEqual(3);
- worksheet.insertColumnAfter(1, 1);
- expect(worksheet.getLastColumn()).toEqual(4);
-});
-
-test('Test moveColumns', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- const range = worksheet.getRange('A1');
- worksheet.moveColumns(range, 2);
-});
-
-test('Test deleteColumns/deleteColumn', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
- workbook.insertSheet(worksheet);
- worksheet.deleteColumn(1);
- const range = worksheet.getRange('A1');
- worksheet.deleteColumns(1, 1);
- const data = worksheet.getConfig().cellData;
- worksheet.getCommandManager().undo();
- worksheet.getCommandManager().redo();
-});
-
-test('Test getGlobalContext', () => {
- const container = createCoreTestContainer();
- const context = container.getSingleton<SheetContext>('Context');
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
-
- expect(worksheet.getContext()).toEqual(context);
-});
-
-test('Test getMerges', () => {
- const container = createCoreTestContainer();
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
-
- expect(worksheet.getMerges()).not.toBeUndefined();
-});
-
-test('Test getSheetData', () => {
- const container = createCoreTestContainer();
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = new Worksheet(context, configure);
- worksheet.setCommandManager(commandManager);
-
- expect(worksheet.getSheetData()).not.toBeUndefined();
-});
-
-test('Test getSelection', () => {
- const container = createCoreTestContainer();
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- configure
- );
- worksheet.setCommandManager(commandManager);
-
- expect(worksheet.getSelection()).not.toBeUndefined();
-});
-
-test('Test setActiveRange', () => {
- const container = createCoreTestContainer();
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- configure
- );
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
- const range = worksheet.getRange({
- startRow: 0,
- endRow: 1,
- startColumn: 0,
- endColumn: 1,
- });
- worksheet.setActiveRange({
- selection: range,
- });
- expect(worksheet.getActiveRange().getRangeData()).toEqual({
- startRow: 0,
- endRow: 1,
- startColumn: 0,
- endColumn: 1,
- });
-});
-
-test('Test setActiveRangeList', () => {
- const container = createCoreTestContainer();
- const workbook = container.getSingleton<Workbook>('WorkBook');
- const context = container.getSingleton<SheetContext>('Context');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- id: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: '1',
- v: 1,
- m: '1',
- },
- 1: {
- s: '1',
- v: 2,
- m: '2',
- },
- 2: {
- s: '1',
- v: 3,
- m: '3',
- },
- },
- 1: {
- 0: {
- s: '1',
- v: 4,
- m: '4',
- },
- 1: {
- s: '1',
- v: 5,
- m: '5',
- },
- 2: {
- s: '1',
- v: 6,
- m: '6',
- },
- },
- 2: {
- 0: {
- s: '1',
- v: 7,
- m: '7',
- },
- 1: {
- s: '1',
- v: 8,
- m: '8',
- },
- 2: {
- s: '1',
- v: 9,
- m: '9',
- },
- },
- },
- rowData: {
- '0': {
- h: 50,
- hd: 0,
- },
- '1': {
- h: 60,
- hd: 1,
- },
- },
- columnData: {
- '0': {
- w: 100,
- hd: 0,
- },
- '1': {
- w: 200,
- hd: 1,
- },
- },
- status: 1,
- tabColor: 'red',
- };
- const worksheet = container.getInstance<Worksheet>(
- 'WorkSheet',
- context,
- configure
- );
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- worksheet.setActiveRangeList({
- selection: [
- {
- startRow: 2,
- endRow: 3,
- startColumn: 2,
- endColumn: 3,
- },
- {
- startRow: 0,
- endRow: 1,
- startColumn: 0,
- endColumn: 1,
- },
- ],
- });
-
- expect(worksheet.getActiveRangeList().getRangeList().length).toEqual(2);
-});
diff --git a/packages/core/test/Observer/Observer.test.ts b/packages/core/test/Observer/Observer.test.ts
deleted file mode 100644
index 1c0a050405..0000000000
--- a/packages/core/test/Observer/Observer.test.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { EventState, Observable, Observer } from '../../src';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Observable add', () => {
- const observable = new Observable((observer: Observer) => {});
- observable.add((eventData, eventState: EventState) => {}, false, false);
-});
-
-test('Observable addOnce', () => {
- const observable = new Observable((observer: Observer) => {});
- observable.addOnce((eventData, eventState: EventState) => {});
-});
diff --git a/packages/core/test/Plugin/Plugin.test.st.ts b/packages/core/test/Plugin/Plugin.test.st.ts
deleted file mode 100644
index a571bb8b54..0000000000
--- a/packages/core/test/Plugin/Plugin.test.st.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { SheetContext } from '../../src/Basics';
-import { Plugin, PluginManager } from '../../src/Plugin';
-import { createCoreTestContainer } from '../ContainerStartUp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Test getGlobalContext', () => {
- const container = createCoreTestContainer();
- const manager: PluginManager = container.get('PluginManager');
- class Test extends Plugin {
- constructor() {
- super('test');
- }
-
- onMounted(context: SheetContext): void {}
- }
- const test = new Test();
- manager.install(test);
- expect(test.getContext()).not.toBeUndefined();
- manager.uninstall('test');
-});
-
-test('Test getName', () => {
- const container = createCoreTestContainer();
- class Test extends Plugin {
- constructor() {
- super('test');
- }
-
- onMounted(context: SheetContext): void {}
- }
- const test = new Test();
- expect(test.getPluginName()).toEqual('test');
-});
-
-test('Test getPluginByName', () => {
- const container = createCoreTestContainer();
- class Test extends Plugin {
- constructor() {
- super('test');
- }
-
- onMounted(context: SheetContext): void {}
- }
- const test = new Test();
- expect(test.getPluginByName('test1')).toBeUndefined();
-});
-
-test('Test addObserve', () => {
- const container = createCoreTestContainer();
- class Test extends Plugin {
- constructor() {
- super('test');
- }
-
- onMounted(context: SheetContext): void {}
- }
- const test = new Test();
- test.pushToObserve('abs1');
- test.pushToObserve('abs2');
- expect(test.getObserver('abs1')).not.toBeNull();
-});
-
-test('Test removeObserve', () => {
- const container = createCoreTestContainer();
- class Test extends Plugin {
- constructor() {
- super('test');
- }
-
- onMounted(context: SheetContext): void {}
- }
- const test = new Test();
- test.pushToObserve('abs1');
- test.pushToObserve('abs2');
- expect(test.getObserver('abs1')).not.toBeNull();
- test.deleteObserve('abs1');
- expect(test.getObserver('abs1')).toBeNull();
-});
diff --git a/packages/core/test/Plugin/PluginManager.test.ts b/packages/core/test/Plugin/PluginManager.test.ts
deleted file mode 100644
index 50613164ed..0000000000
--- a/packages/core/test/Plugin/PluginManager.test.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { createCoreTestContainer } from '../ContainerStartUp';
-import { SheetContext, PluginManager, Plugin } from '../../src';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Test _initialize', () => {
- class MyPlugin extends Plugin {
- constructor() {
- super('plugin');
- }
-
- onMounted(context: SheetContext): void {}
- }
- const container = createCoreTestContainer();
- const context: SheetContext = container.get('Context');
- const manager2: PluginManager = container.createInstance(
- PluginManager,
- context,
- []
- );
- const manager1: PluginManager = container.createInstance(
- PluginManager,
- context,
- [new MyPlugin()]
- );
- manager1.setContext(context);
- manager2.setContext(context);
-});
-
-test('Test install', () => {
- const container = createCoreTestContainer();
- const context: SheetContext = container.get('Context');
- const manager: PluginManager = container.createInstance(PluginManager, context);
- class MyPlugin extends Plugin {
- constructor() {
- super('plugin');
- }
-
- onMounted(context: SheetContext): void {}
- }
- const plugin = new MyPlugin();
- manager.install(plugin);
-});
-
-test('Test getPluginByName', () => {
- const container = createCoreTestContainer();
- const context: SheetContext = container.get('Context');
- const manager: PluginManager = container.createInstance(PluginManager, context);
- class MyPlugin extends Plugin {
- constructor() {
- super('plugin');
- }
-
- onMounted(context: SheetContext): void {}
- }
- const plugin = new MyPlugin();
- manager.install(plugin);
- expect(manager.getPluginByName('plugin')).not.toBeUndefined();
-});
-
-test('Test uninstall', () => {
- const container = createCoreTestContainer();
- const context: SheetContext = container.get('Context');
- const manager: PluginManager = container.createInstance(PluginManager, context);
- class MyPlugin extends Plugin {
- constructor() {
- super('plugin');
- }
-
- onMounted(context: SheetContext): void {}
- }
- const plugin = new MyPlugin();
- manager.install(plugin);
- expect(manager.getPluginByName('plugin')).not.toBeUndefined();
- manager.uninstall('plugin');
- expect(manager.getPluginByName('plugin')).toBeUndefined();
-});
diff --git a/packages/core/test/Server/IOHttp.test.ts b/packages/core/test/Server/IOHttp.test.ts
deleted file mode 100644
index a4a38192d3..0000000000
--- a/packages/core/test/Server/IOHttp.test.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { IOHttp, IOHttpRequestType } from '../../src/Shared/IOHttp';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-const child_process = require('child_process');
-const os = require('os');
-
-function osType() {
- if (os.type() === 'Windows_NT') {
- // windows
- return 'windows';
- }
- if (os.type() === 'Darwin') {
- // mac
- return 'mac';
- }
- if (os.type() === 'Linux') {
- // Linux
- return 'linux';
- }
- // Prompt not supported
- return '';
-}
-
-describe('IOHttp', () => {
- afterAll(async () => {
- // stop http server
- if (osType() === 'windows') {
- child_process.exec(
- 'for /f "tokens=5" %a in (\'netstat -aon ^| find "0.0.0.0:3998" ^| find "LISTENING"\') do taskkill /f /pid %a'
- );
- } else if (osType() === 'mac') {
- // https://stackoverflow.com/a/36917850
- child_process.exec(
- "kill -9 `lsof -i TCP:3998 | awk '/LISTEN/{print $2}'`"
- );
- }
- });
-
- test('IOHttp Get Test', (done) => {
- const service = {
- actionName: 'setStyle',
- type: 'color',
- value: 'red',
- };
- IOHttp({
- contentType: 'application/json',
- url: 'http://127.0.0.1:3998/action/',
- data: service,
- type: IOHttpRequestType.POST,
- success: (json: any) => {
- expect(json.message.actionName).toEqual(service.actionName);
- done();
- },
- });
- // IOHttp({
- // contentType: 'application/json',
- // url: 'http://universheet.lashuju.com/action/',
- // data: service,
- // type: IOHttpRequestType.POST,
- // success: (json: any) => {
- // expect(json.message.actionName).toEqual(service.actionName);
- // done();
- // },
- // });
- });
-});
diff --git a/packages/core/test/Server/server.js b/packages/core/test/Server/server.js
deleted file mode 100644
index 041d58ce89..0000000000
--- a/packages/core/test/Server/server.js
+++ /dev/null
@@ -1,64 +0,0 @@
-const http = require('http');
-
-const server = http.createServer();
-server.on('request', (req, res) => {
- res.setHeader('Access-Control-Allow-Origin', '*');
- res.setHeader(
- 'Access-Control-Allow-Headers',
- 'Content-Type,Content-Length, Authorization, Accept,X-Requested-With'
- );
- res.setHeader('Access-Control-Allow-Methods', 'PUT,POST,GET,DELETE,OPTIONS');
- if (req.url === '/') {
- const responseBody = {
- index: 1,
- };
-
- res.statusCode = 200;
- res.write(JSON.stringify(responseBody));
- res.end();
- } else if (req.url.indexOf('/action') === 0 && req.method === 'POST') {
- const chunks = [];
- req.on('data', (chunk) => chunks.push(chunk));
- req.on('end', () => {
- // buffer => string => object
- const dataStr = Buffer.concat(chunks).toString();
- const data = JSON.parse(JSONize(dataStr));
-
- const json = {
- message: {
- actionName: data.actionName,
- },
- code: 0,
- };
- res.statusCode = 200;
- res.write(JSON.stringify(json));
- res.end();
- });
- }
-});
-
-server.listen(3998, () => {
- console.log('Node server running on port 3998...');
-});
-
-const JSONize = (str) =>
- // https://stackoverflow.com/questions/14432165/uncaught-syntaxerror-unexpected-token-with-json-parse/50730876
- str
- .replace(/\\n/g, '\\n')
- .replace(/\\'/g, "\\'")
- .replace(/\\"/g, '\\"')
- .replace(/\\&/g, '\\&')
- .replace(/\\r/g, '\\r')
- .replace(/\\t/g, '\\t')
- .replace(/\\b/g, '\\b')
- .replace(/\\f/g, '\\f')
- // remove non-printable and other non-valid JSON chars
- .replace(/[\u0000-\u0019]+/g, '')
-
- // https://stackoverflow.com/questions/9036429/convert-object-string-to-json
- // wrap keys without quote with valid double quote
- .replace(/([\w]+)\s*:/g, (_, $1) => `"${$1}":`)
- // replacing single quote wrapped ones to double quote
- .replace(/'([^']+)'/g, (_, $1) => `"${$1}"`)
- // '{ "value": "red", }' to '{ "value": "red" }'
- .replace(/,(?=\s*})/g, '');
diff --git a/packages/core/test/Shared/LRUMap.test.ts b/packages/core/test/Shared/LRUMap.test.ts
deleted file mode 100644
index 2408b672da..0000000000
--- a/packages/core/test/Shared/LRUMap.test.ts
+++ /dev/null
@@ -1,134 +0,0 @@
-import { LRUMap } from '../../src/Shared';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('LRU Test Key', () => {
- let c = new LRUMap(4, [
- ['adam', 29],
- ['john', 26],
- ['angela', 24],
- ['bob', 48],
- ]);
- let kit = c.keys();
- expect(kit.next().value).toEqual('adam');
- expect(kit.next().value).toEqual('john');
- expect(kit.next().value).toEqual('angela');
- expect(kit.next().value).toEqual('bob');
- expect(kit.next().done).toBeTruthy();
-});
-
-test('LRU Test Value', () => {
- let c = new LRUMap(4, [
- ['adam', 29],
- ['john', 26],
- ['angela', 24],
- ['bob', 48],
- ]);
- let kit = c.values();
- expect(kit.next().value).toEqual(29);
- expect(kit.next().value).toEqual(26);
- expect(kit.next().value).toEqual(24);
- expect(kit.next().value).toEqual(48);
- expect(kit.next().done).toBeTruthy();
-});
-
-test('LRU Test Clear', () => {
- let c = new LRUMap(4);
- c.set('adam', 29);
- c.set('john', 26);
- expect(c.size).toEqual(2);
- c.clear();
- expect(c.size).toEqual(0);
- expect(c.oldest).toEqual(undefined);
- expect(c.newest).toEqual(undefined);
-});
-
-test('LRU Test Delete', () => {
- let c = new LRUMap([
- ['adam', 29],
- ['john', 26],
- ['angela', 24],
- ['bob', 48],
- ]);
- expect(c.get('adam')).toEqual(29);
- c.delete('adam');
- expect(c.size).toEqual(3);
- expect(c.get('adam')).toEqual(undefined);
- c.delete('angela');
- expect(c.size).toEqual(2);
- c.delete('bob');
- expect(c.size).toEqual(1);
- c.delete('john');
- expect(c.size).toEqual(0);
- expect(c.get('john')).toEqual(undefined);
- expect(c.oldest).toEqual(undefined);
- expect(c.newest).toEqual(undefined);
-});
-
-test('LRU Test Set', () => {
- let c = new LRUMap(4);
- c.set('a', 1);
- c.set('a', 2);
- c.set('a', 3);
- c.set('a', 4);
- expect(c.size).toEqual(1);
- expect(c.newest).toEqual(c.oldest);
- expect(c.newest?.toJSON()).toEqual({ key: 'a', value: 4 });
-
- c.set('a', 5);
- expect(c.size).toEqual(1);
- expect(c.newest).toEqual(c.oldest);
- expect(c.newest?.toJSON()).toEqual({ key: 'a', value: 5 });
-
- c.set('b', 6);
- expect(c.size).toEqual(2);
- expect(c.newest !== c.oldest).toBeTruthy();
-
- expect(c.newest?.toJSON()).toEqual({ key: 'b', value: 6 });
- expect(c.oldest?.toJSON()).toEqual({ key: 'a', value: 5 });
-
- c.shift();
- expect(c.size).toEqual(1);
- c.shift();
- expect(c.size).toEqual(0);
-});
-
-test('LRU Set And Get', () => {
- let c = new LRUMap(4);
- expect(c.size).toEqual(0);
- expect(c.limit).toEqual(4);
- expect(c.oldest).toEqual(undefined);
- expect(c.newest).toEqual(undefined);
-
- c.set('adam', 29).set('john', 26).set('angela', 24).set('bob', 48);
- expect(c.toString()).toEqual('adam:29 < john:26 < angela:24 < bob:48');
- expect(c.size).toEqual(4);
-
- expect(c.get('adam')).toEqual(29);
- expect(c.get('john')).toEqual(26);
- expect(c.get('angela')).toEqual(24);
- expect(c.get('bob')).toEqual(48);
- expect(c.toString()).toEqual('adam:29 < john:26 < angela:24 < bob:48');
-
- expect(c.get('angela')).toEqual(24);
- expect(c.toString()).toEqual('adam:29 < john:26 < bob:48 < angela:24');
-
- c.set('ygwie', 81);
- expect(c.toString()).toEqual('john:26 < bob:48 < angela:24 < ygwie:81');
- expect(c.size).toEqual(4);
- expect(c.get('adam')).toEqual(undefined);
-
- c.set('john', 11);
- expect(c.toString()).toEqual('bob:48 < angela:24 < ygwie:81 < john:11');
- expect(c.get('john')).toEqual(11);
-
- let expectedKeys = ['bob', 'angela', 'ygwie', 'john'];
- c.forEach((v, k) => {
- //sys.sets(k+': '+v);
- expect(k).toEqual(expectedKeys.shift());
- });
-
- let currentSize = c.size;
- expect(c.delete('john') !== undefined).toBeTruthy();
- expect(currentSize - 1).toEqual(c.size);
-});
diff --git a/packages/core/test/Shared/Locale.test.ts b/packages/core/test/Shared/Locale.test.ts
deleted file mode 100644
index b28048056f..0000000000
--- a/packages/core/test/Shared/Locale.test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-
-import { LocaleType, UniverSheet } from '../../src';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-// mock data
-const zh = {
- type: '表格',
-};
-const en = {
- type: 'table',
-};
-
-test('Test Locale', () => {
- const univerSheet = UniverSheet.newInstance({
- id: 'workbook-01',
- sheets: [
- {
- name: 'first sheet',
- },
- ],
- locale: LocaleType.ZH,
- });
-
- const locale = univerSheet.context.getLocale();
-
- locale.load({ zh, en });
-
- expect(locale.get('type')).toEqual('表格');
-
- locale.change(LocaleType.EN);
-
- expect(locale.get('type')).toEqual('table');
-});
diff --git a/packages/core/test/Shared/Logger.test.ts b/packages/core/test/Shared/Logger.test.ts
deleted file mode 100644
index aac7e70155..0000000000
--- a/packages/core/test/Shared/Logger.test.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { Logger } from '../../src';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('test info', () => {
- Logger.info('info');
-});
-
-test('test error', () => {
- Logger.error('error');
-});
-
-test('test warn', () => {
- Logger.error('warn');
-});
-
-test('test br', () => {
- Logger.error('br');
-});
diff --git a/packages/core/test/Shared/Migrate.test.ts b/packages/core/test/Shared/Migrate.test.ts
deleted file mode 100644
index 22e07c86c0..0000000000
--- a/packages/core/test/Shared/Migrate.test.ts
+++ /dev/null
@@ -1,6061 +0,0 @@
-import { migrate } from '../../src/Shared';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('migrate', () => {
- // univer 2.0 config
- const sheetCell = {
- name: 'Cell',
- config: {
- merge: {
- '13_5': {
- r: 13,
- c: 5,
- rs: 3,
- cs: 1,
- },
- '13_7': {
- r: 13,
- c: 7,
- rs: 3,
- cs: 2,
- },
- '14_2': {
- r: 14,
- c: 2,
- rs: 1,
- cs: 2,
- },
- '15_10': {
- r: 15,
- c: 10,
- rs: 4,
- cs: 3,
- },
- },
- borderInfo: [
- {
- rangeType: 'cell',
- value: {
- row_index: 3,
- col_index: 3,
- l: {
- style: 10,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 10,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 10,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 10,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 3,
- col_index: 4,
- l: {
- style: 10,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 10,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 10,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 10,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 3,
- col_index: 5,
- l: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 3,
- col_index: 6,
- l: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 3,
- col_index: 7,
- l: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 3,
- col_index: 8,
- l: {
- style: 1,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 1,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 1,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 1,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 5,
- col_index: 2,
- l: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 5,
- col_index: 3,
- l: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 5,
- col_index: 4,
- l: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 5,
- col_index: 5,
- l: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 9,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 5,
- col_index: 6,
- l: {
- style: 1,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 1,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 1,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 1,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 5,
- col_index: 7,
- l: {
- style: 1,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 1,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 1,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 1,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 5,
- col_index: 8,
- l: {
- style: 2,
- color: 'rgb(255, 0, 0)',
- },
- r: {
- style: 2,
- color: 'rgb(255, 0, 0)',
- },
- t: {
- style: 2,
- color: 'rgb(255, 0, 0)',
- },
- b: {
- style: 2,
- color: 'rgb(255, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 7,
- col_index: 2,
- l: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- r: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- t: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- b: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 7,
- col_index: 3,
- l: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- r: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- t: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- b: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 7,
- col_index: 5,
- l: {
- style: 2,
- color: 'rgb(154, 205, 50)',
- },
- t: {
- style: 2,
- color: 'rgb(154, 205, 50)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 7,
- col_index: 6,
- r: {
- style: 2,
- color: 'rgb(154, 205, 50)',
- },
- t: {
- style: 2,
- color: 'rgb(154, 205, 50)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 7,
- col_index: 8,
- r: {
- style: 9,
- color: 'rgb(0, 0, 0)',
- },
- b: {
- style: 9,
- color: 'rgb(0, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 7,
- col_index: 9,
- l: {
- style: 9,
- color: 'rgb(0, 0, 0)',
- },
- b: {
- style: 9,
- color: 'rgb(0, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 8,
- col_index: 2,
- l: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- r: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- t: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- b: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 8,
- col_index: 3,
- l: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- r: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- t: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- b: {
- style: 9,
- color: 'rgb(0, 0, 255)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 8,
- col_index: 5,
- l: {
- style: 2,
- color: 'rgb(154, 205, 50)',
- },
- b: {
- style: 2,
- color: 'rgb(154, 205, 50)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 8,
- col_index: 6,
- r: {
- style: 2,
- color: 'rgb(154, 205, 50)',
- },
- b: {
- style: 2,
- color: 'rgb(154, 205, 50)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 8,
- col_index: 8,
- r: {
- style: 9,
- color: 'rgb(0, 0, 0)',
- },
- t: {
- style: 9,
- color: 'rgb(0, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 8,
- col_index: 9,
- l: {
- style: 9,
- color: 'rgb(0, 0, 0)',
- },
- t: {
- style: 9,
- color: 'rgb(0, 0, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 10,
- col_index: 2,
- l: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- t: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- b: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 10,
- col_index: 3,
- r: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- t: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- b: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 10,
- col_index: 5,
- l: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- r: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- t: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 10,
- col_index: 6,
- l: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- r: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- t: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 10,
- col_index: 7,
- l: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- r: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- t: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 11,
- col_index: 2,
- l: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- t: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- b: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 11,
- col_index: 3,
- r: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- t: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- b: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 11,
- col_index: 5,
- l: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- r: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 11,
- col_index: 6,
- l: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- r: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 11,
- col_index: 7,
- l: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- r: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 12,
- col_index: 2,
- l: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- t: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- b: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 12,
- col_index: 3,
- r: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- t: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- b: {
- style: 1,
- color: 'rgb(144, 238, 144)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 12,
- col_index: 5,
- l: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- r: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- b: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 12,
- col_index: 6,
- l: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- r: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- b: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 12,
- col_index: 7,
- l: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- r: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- b: {
- style: 1,
- color: 'rgb(205, 205, 0)',
- },
- },
- },
- {
- rangeType: 'range',
- borderType: 'border-none',
- style: '2',
- color: '#000',
- range: [
- {
- row: [3, 3],
- column: [3, 4],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '2',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [3, 4],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-none',
- style: '4',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [4, 4],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '3',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [4, 4],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-none',
- style: '3',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [3, 3],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '2',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [3, 3],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-none',
- style: '2',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [5, 5],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-none',
- style: '2',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [8, 8],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-none',
- style: '2',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [3, 8],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '4',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [7, 7],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '1',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [8, 8],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '5',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [6, 6],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '6',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [5, 5],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-none',
- style: '3',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [4, 4],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '3',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [4, 4],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '2',
- color: '#ff0000',
- range: [
- {
- row: [3, 3],
- column: [3, 3],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-none',
- style: '2',
- color: '#ff0000',
- range: [
- {
- row: [5, 5],
- column: [2, 9],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '9',
- color: '#ff0000',
- range: [
- {
- row: [5, 5],
- column: [5, 5],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '8',
- color: '#ff0000',
- range: [
- {
- row: [5, 5],
- column: [6, 6],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '13',
- color: '#ff0000',
- range: [
- {
- row: [5, 5],
- column: [7, 7],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '13',
- color: '#ff0000',
- range: [
- {
- row: [6, 6],
- column: [11, 11],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '10',
- color: '#ff0000',
- range: [
- {
- row: [5, 5],
- column: [4, 4],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '11',
- color: '#ff0000',
- range: [
- {
- row: [5, 5],
- column: [3, 3],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-none',
- style: '11',
- color: '#ff0000',
- range: [
- {
- row: [7, 8],
- column: [2, 3],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-all',
- style: '3',
- color: '#0000ff',
- range: [
- {
- row: [7, 8],
- column: [2, 3],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-inside',
- style: '3',
- color: '#0000ff',
- range: [
- {
- row: [7, 8],
- column: [8, 9],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-inside',
- style: '9',
- color: '#0000ff',
- range: [
- {
- row: [7, 8],
- column: [8, 9],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-inside',
- style: '2',
- color: '#0000ff',
- range: [
- {
- row: [7, 8],
- column: [8, 9],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-inside',
- style: '9',
- color: '#0000ff',
- range: [
- {
- row: [7, 8],
- column: [8, 9],
- },
- ],
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 10,
- col_index: 10,
- l: {
- color: '#ff0000',
- style: '13',
- },
- r: {
- color: '#ff0000',
- style: '13',
- },
- t: {
- color: '#ff0000',
- style: '13',
- },
- b: {
- color: '#ff0000',
- style: '13',
- },
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 6,
- col_index: 11,
- l: null,
- r: null,
- t: null,
- b: null,
- },
- },
- {
- rangeType: 'cell',
- value: {
- row_index: 10,
- col_index: 10,
- l: null,
- r: null,
- t: null,
- b: null,
- },
- },
- {
- rangeType: 'range',
- borderType: 'border-outside',
- style: '13',
- color: '#00ff00',
- range: [
- {
- row: [10, 12],
- column: [2, 3],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-horizontal',
- style: '13',
- color: '#00ff00',
- range: [
- {
- row: [10, 12],
- column: [2, 3],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-vertical',
- style: '13',
- color: '#ff9900',
- range: [
- {
- row: [10, 12],
- column: [5, 7],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-outside',
- style: '13',
- color: '#ff9900',
- range: [
- {
- row: [10, 12],
- column: [5, 7],
- },
- ],
- },
- {
- rangeType: 'range',
- borderType: 'border-none',
- style: '1',
- color: '#ff9900',
- range: [
- {
- row: [19, 19],
- column: [6, 6],
- },
- ],
- },
- ],
- rowlen: {
- '0': 20,
- '1': 20,
- '2': 20,
- '3': 20,
- '4': 20,
- '5': 20,
- '6': 20,
- '7': 20,
- '8': 20,
- '9': 20,
- '10': 20,
- '11': 20,
- '12': 20,
- '13': 20,
- '14': 20,
- '15': 20,
- '16': 20,
- '17': 31,
- '18': 20,
- '19': 20,
- '20': 20,
- '21': 20,
- '22': 20,
- '23': 20,
- '24': 20,
- '25': 79,
- '26': 20,
- '27': 20,
- '28': 80,
- '29': 36,
- },
- columnlen: {
- '0': 131,
- '2': 153,
- '3': 128,
- '4': 136,
- '5': 122,
- '6': 138,
- '7': 131,
- '8': 128,
- '9': 140,
- '10': 144,
- },
- rowhidden: {
- '30': 0,
- '31': 0,
- },
- customHeight: {
- '29': 1,
- },
- customWidth: {
- '2': 1,
- },
- },
- index: '0',
- zoomRatio: 1,
- order: '0',
- column: 18,
- row: 36,
- status: 1,
- celldata: [
- {
- r: 0,
- c: 0,
- v: {
- customKey: { a: 1 },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- v: 1,
- ct: { fa: 'General', t: 'n' },
- m: '1',
- },
- },
- {
- r: 0,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- v: 2,
- ct: { fa: 'General', t: 'n' },
- m: '2',
- },
- },
- {
- r: 0,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- v: 3,
- ct: { fa: 'General', t: 'n' },
- m: '3',
- },
- },
- {
- r: 0,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- v: 0,
- ct: { fa: 'General', t: 'n' },
- m: '0',
- f: '=Formula!D3+Formula!D4',
- },
- },
- {
- r: 0,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 0,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 0,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 0,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 0,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 0,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 0,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 1,
- c: 0,
- v: {
- v: 'Background',
- ct: { fa: 'General', t: 'g' },
- m: 'Background',
- bg: null,
- bl: 1,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 1,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 1,
- c: 2,
- v: {
- bg: 'rgb(30, 144, 255)',
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 1,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 1,
- c: 4,
- v: {
- bg: 'rgb(0, 255, 0)',
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 1,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 1,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 1,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 1,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 1,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 1,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 2,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 2,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 2,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 2,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 2,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 2,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 2,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 2,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 2,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 2,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 2,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 3,
- c: 0,
- v: {
- v: 'Border',
- ct: { fa: 'General', t: 'g' },
- m: 'Border',
- bg: null,
- bl: 1,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 3,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 3,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 3,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 3,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 3,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 3,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 3,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 3,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 3,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 3,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 4,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 4,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 4,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 4,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 4,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 4,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 4,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 4,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 4,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 4,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 4,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 5,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- ct: {
- fa: 'General',
- t: 'inlineStr',
- s: [
- {
- ff: 'Arial',
- fc: 'rgb(255, 0, 0)',
- fs: 12,
- cl: 0,
- un: 0,
- bl: 0,
- it: 0,
- v: 'Inline',
- },
- {
- ff: 'Arial',
- fc: '#000000',
- fs: 12,
- cl: 0,
- un: 0,
- bl: 0,
- it: 0,
- v: ' ',
- },
- {
- ff: 'Arial',
- fc: '#000000',
- fs: 16,
- cl: 1,
- un: 0,
- bl: 0,
- it: 1,
- v: 'Style',
- },
- {
- ff: 'Arial',
- fc: '#000000',
- fs: 12,
- cl: 0,
- un: 0,
- bl: 0,
- it: 0,
- v: ' ',
- },
- {
- ff: 'Arial',
- fc: '#000000',
- fs: 12,
- cl: 0,
- un: 0,
- bl: 1,
- it: 0,
- v: 'Cell',
- },
- ],
- },
- },
- },
- {
- r: 5,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 5,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 5,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 5,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 5,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 5,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 5,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 5,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 5,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 5,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 6,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 6,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 6,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 6,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 6,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 6,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 6,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 6,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 6,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 6,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 6,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 7,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 7,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 7,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 7,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 7,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 7,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 7,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 7,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 7,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 7,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 7,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 8,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 8,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 8,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 8,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 8,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 8,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 8,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 8,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 8,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 8,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 8,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 9,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 9,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 9,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 9,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 9,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 9,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 9,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 9,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 9,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 9,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 9,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 10,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 10,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 10,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 10,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 10,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 10,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 10,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 10,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 10,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 10,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 10,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 11,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 11,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 11,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 11,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 11,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 11,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 11,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 11,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 11,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 11,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 11,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 12,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 12,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 12,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 12,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 12,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 12,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 12,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 12,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 12,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 12,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 12,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 13,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 13,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 13,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 13,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 13,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 13,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- mc: { r: 13, c: 5, rs: 3, cs: 1 },
- },
- },
- {
- r: 13,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 13,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- mc: { r: 13, c: 7, rs: 3, cs: 2 },
- },
- },
- { r: 13, c: 8, v: { mc: { r: 13, c: 7 } } },
- {
- r: 13,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 13,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 14,
- c: 0,
- v: {
- v: 'Span',
- ct: { fa: 'General', t: 'g' },
- m: 'Span',
- bg: null,
- bl: 1,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 14,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 14,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- mc: { r: 14, c: 2, rs: 1, cs: 2 },
- },
- },
- { r: 14, c: 3, v: { mc: { r: 14, c: 2 } } },
- {
- r: 14,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- { r: 14, c: 5, v: { mc: { r: 13, c: 5 } } },
- {
- r: 14,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- { r: 14, c: 7, v: { mc: { r: 13, c: 7 } } },
- { r: 14, c: 8, v: { mc: { r: 13, c: 7 } } },
- {
- r: 14,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 14,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 15,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 15,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 15,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 15,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 15,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- { r: 15, c: 5, v: { mc: { r: 13, c: 5 } } },
- {
- r: 15,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- { r: 15, c: 7, v: { mc: { r: 13, c: 7 } } },
- { r: 15, c: 8, v: { mc: { r: 13, c: 7 } } },
- {
- r: 15,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 15,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- mc: { r: 15, c: 10, rs: 4, cs: 3 },
- },
- },
- { r: 15, c: 11, v: { mc: { r: 15, c: 10 } } },
- { r: 15, c: 12, v: { mc: { r: 15, c: 10 } } },
- {
- r: 16,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 16,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 16,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 16,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 16,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 16,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 16,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 16,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 16,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 16,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 16,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- mc: { r: 15, c: 10 },
- },
- },
- { r: 16, c: 11, v: { mc: { r: 15, c: 10 } } },
- { r: 16, c: 12, v: { mc: { r: 15, c: 10 } } },
- {
- r: 17,
- c: 0,
- v: {
- v: 'Font',
- ct: { fa: 'General', t: 'g' },
- m: 'Font',
- bg: null,
- bl: 1,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 17,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 17,
- c: 2,
- v: {
- v: 'UniverSheet',
- ct: { fa: 'General', t: 'g' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: '11',
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: 'UniverSheet',
- },
- },
- {
- r: 17,
- c: 3,
- v: {
- v: 'UniverSheet',
- ct: { fa: 'General', t: 'g' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 13,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: 'UniverSheet',
- },
- },
- {
- r: 17,
- c: 4,
- v: {
- v: 'UniverSheet',
- ct: { fa: 'General', t: 'g' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: 'UniverSheet',
- },
- },
- {
- r: 17,
- c: 5,
- v: {
- v: 'UniverSheet',
- ct: { fa: 'General', t: 'g' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 13,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: 'UniverSheet',
- },
- },
- {
- r: 17,
- c: 6,
- v: {
- v: 'UniverSheet',
- ct: { fa: 'General', t: 'g' },
- bg: 'rgb(255, 215, 0)',
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: 'UniverSheet',
- },
- },
- {
- r: 17,
- c: 7,
- v: {
- v: 'UniverSheet',
- ct: { fa: 'General', t: 'g' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(67, 110, 238)',
- ht: 1,
- vt: 1,
- m: 'UniverSheet',
- },
- },
- {
- r: 17,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 17,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 17,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- mc: { r: 15, c: 10 },
- },
- },
- { r: 17, c: 11, v: { mc: { r: 15, c: 10 } } },
- { r: 17, c: 12, v: { mc: { r: 15, c: 10 } } },
- {
- r: 18,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 18,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 18,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 18,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 18,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 18,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 18,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 18,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 18,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 18,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 18,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- mc: { r: 15, c: 10 },
- },
- },
- { r: 18, c: 11, v: { mc: { r: 15, c: 10 } } },
- { r: 18, c: 12, v: { mc: { r: 15, c: 10 } } },
- {
- r: 19,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 19,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 19,
- c: 2,
- v: {
- v: 'UniverSheet',
- ct: { fa: 'General', t: 'g' },
- bg: 'rgb(67, 110, 238)',
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(255, 215, 0)',
- ht: 1,
- vt: 1,
- m: 'UniverSheet',
- },
- },
- {
- r: 19,
- c: 3,
- v: {
- v: 'UniverSheet',
- ct: { fa: 'General', t: 'g' },
- bg: null,
- bl: 1,
- it: 0,
- ff: 0,
- fs: '10',
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: 'UniverSheet',
- },
- },
- {
- r: 19,
- c: 4,
- v: {
- v: 'UniverSheet',
- ct: { fa: 'General', t: 'g' },
- bg: null,
- bl: 0,
- it: 1,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: 'UniverSheet',
- },
- },
- {
- r: 19,
- c: 5,
- v: {
- v: 'UniverSheet',
- ct: { fa: 'General', t: 'g' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- cl: 1,
- m: 'UniverSheet',
- },
- },
- {
- r: 19,
- c: 6,
- v: {
- ct: { fa: 'General', t: 'g' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: '1',
- vt: '0',
- cl: 1,
- },
- },
- {
- r: 19,
- c: 7,
- v: {
- ct: { fa: 'General', t: 'g' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 19,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 19,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 19,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 20,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 20,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 20,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 20,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 20,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 20,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 20,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 20,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 20,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 20,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 20,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 21,
- c: 0,
- v: {
- v: 'Format',
- ct: { fa: 'General', t: 'g' },
- m: 'Format',
- bg: null,
- bl: 1,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 21,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 21,
- c: 2,
- v: {
- ct: { fa: '##0.00', t: 'n' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: '0.25',
- v: 0.25,
- },
- },
- {
- r: 21,
- c: 3,
- v: {
- ct: { fa: '$#,##0.00_);($#,##0.00)', t: 'n' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: '$0.25 ',
- v: 0.25,
- },
- },
- {
- r: 21,
- c: 4,
- v: {
- ct: { fa: '"$" 0.00', t: 'n' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: '$ 0.25',
- v: 0.25,
- },
- },
- {
- r: 21,
- c: 5,
- v: {
- ct: { fa: '0%', t: 'n' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: '25%',
- v: 0.25,
- },
- },
- {
- r: 21,
- c: 6,
- v: {
- ct: { fa: '# ?/?', t: 'n' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: ' 1/4',
- v: 0.25,
- },
- },
- {
- r: 21,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 21,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 21,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 21,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 22,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 22,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 22,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 22,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 22,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 22,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 22,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 22,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 22,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 22,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 22,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 23,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 23,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 23,
- c: 2,
- v: {
- ct: { fa: '0.00E+00', t: 'n' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- m: '2.50E-01',
- v: 0.25,
- },
- },
- {
- r: 23,
- c: 3,
- v: {
- v: 0.25,
- ct: { fa: '0.00', t: 'n' },
- m: '0.25',
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 23,
- c: 4,
- v: {
- ct: { fa: 'AM/PM h:mm:ss', t: 'd' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- v: 44032,
- m: 'AM 12:00:00',
- },
- },
- {
- r: 23,
- c: 5,
- v: {
- ct: { fa: 'yyyy/MM/dd', t: 'd' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- v: 44032,
- m: '2020/07/20',
- },
- },
- {
- r: 23,
- c: 6,
- v: {
- ct: { fa: 'yyyy"年"M"月"d"日"', t: 'd' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- v: 44032,
- m: '2020年7月20日',
- },
- },
- {
- r: 23,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 23,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 23,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 23,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 24,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 24,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 24,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 24,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 24,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 24,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 24,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 24,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 24,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 24,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 24,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 25,
- c: 0,
- v: {
- v: 'Alignment',
- ct: { fa: 'General', t: 'g' },
- m: 'Alignment',
- bg: null,
- bl: 1,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 25,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 25,
- c: 2,
- v: {
- v: 'Top Left',
- ct: { fa: 'General', t: 'g' },
- m: 'Top Left',
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: '1',
- vt: '1',
- },
- },
- {
- r: 25,
- c: 3,
- v: {
- v: 'Top Center',
- ct: { fa: 'General', t: 'g' },
- m: 'Top Center',
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: '0',
- vt: '1',
- },
- },
- {
- r: 25,
- c: 4,
- v: {
- v: 'Top Right',
- ct: { fa: 'General', t: 'g' },
- m: 'Top Right',
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: '2',
- vt: '1',
- },
- },
- {
- r: 25,
- c: 5,
- v: {
- v: 'Center Left',
- ct: { fa: 'General', t: 'g' },
- m: 'Center Left',
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: '1',
- vt: '0',
- },
- },
- {
- r: 25,
- c: 6,
- v: {
- v: 'Center Center',
- ct: { fa: 'General', t: 'g' },
- m: 'Center Center',
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: '0',
- vt: '0',
- },
- },
- {
- r: 25,
- c: 7,
- v: {
- v: 'Center Right',
- ct: { fa: 'General', t: 'g' },
- m: 'Center Right',
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: '2',
- vt: '0',
- },
- },
- {
- r: 25,
- c: 8,
- v: {
- v: 'Bottom Left',
- ct: { fa: 'General', t: 'g' },
- m: 'Bottom Left',
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: '1',
- vt: '2',
- },
- },
- {
- r: 25,
- c: 9,
- v: {
- v: 'Bottom Center',
- ct: { fa: 'General', t: 'g' },
- m: 'Bottom Center',
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: '0',
- vt: '2',
- },
- },
- {
- r: 25,
- c: 10,
- v: {
- v: 'Bottom Right',
- ct: { fa: 'General', t: 'g' },
- m: 'Bottom Right',
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: '2',
- vt: '2',
- },
- },
- {
- r: 26,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 26,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 26,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 26,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 26,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 26,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 26,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 26,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 26,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 26,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 26,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 27,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 27,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 27,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 27,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 27,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 27,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 27,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 27,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 27,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 27,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 27,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 28,
- c: 0,
- v: {
- v: 'WordWrap',
- ct: { fa: 'General', t: 'g' },
- m: 'WordWrap',
- bg: null,
- bl: 1,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 28,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 28,
- c: 2,
- v: {
- v: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- ct: { fa: 'General', t: 'g' },
- m: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- tb: '2',
- },
- },
- {
- r: 28,
- c: 3,
- v: {
- ct: { fa: 'General', t: 'g' },
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- tb: '1',
- },
- },
- {
- r: 28,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 28,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 28,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 28,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 28,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 28,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 28,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- {
- r: 29,
- c: 0,
- v: {
- ct: {
- fa: 'General',
- t: 'inlineStr',
- s: [
- {
- ff: '"times new roman"',
- fc: 'rgb(51, 51, 51)',
- fs: '12',
- cl: 0,
- un: 0,
- bl: 1,
- it: 0,
- v: 'TextRotate',
- },
- ],
- },
- ht: '1',
- vt: '0',
- },
- },
- {
- r: 29,
- c: 2,
- v: {
- ct: { fa: 'General', t: 'g' },
- v: 'I am UniverSheet text rotate style',
- m: 'I am UniverSheet text rotate style',
- tr: '1',
- tb: '2',
- ht: '1',
- fs: '12',
- },
- },
- {
- r: 29,
- c: 3,
- v: {
- ct: { fa: 'General', t: 'g' },
- v: 'I am UniverSheet text rotate style',
- m: 'I am UniverSheet text rotate style',
- tr: '2',
- tb: '2',
- ht: '0',
- fs: '12',
- },
- },
- {
- r: 29,
- c: 4,
- v: {
- ct: { fa: 'General', t: 'g' },
- v: 'I am UniverSheet text rotate style',
- m: 'I am UniverSheet text rotate style',
- tr: '4',
- tb: '2',
- ht: '1',
- fs: '12',
- vt: '2',
- },
- },
- {
- r: 29,
- c: 5,
- v: {
- ct: { fa: 'General', t: 'g' },
- v: 'I am UniverSheet text rotate style',
- m: 'I am UniverSheet text rotate style',
- tr: '5',
- tb: '2',
- ht: '1',
- fs: '12',
- },
- },
- {
- r: 29,
- c: 6,
- v: {
- ct: { fa: 'General', t: 'g' },
- v: 'I am UniverSheet text rotate style',
- m: 'I am UniverSheet text rotate style',
- tr: '1',
- tb: '1',
- ht: '1',
- fs: '12',
- vt: '0',
- },
- },
- {
- r: 30,
- c: 0,
- v: { ct: { fa: 'General', t: 'g' }, v: 'hidden1', m: 'hidden1' },
- },
- {
- r: 31,
- c: 0,
- v: { m: 'hidden2', ct: { fa: 'General', t: 'g' }, v: 'hidden2' },
- },
- {
- r: 33,
- c: 0,
- v: {
- ct: { fa: 'General', t: 'g' },
- bg: null,
- bl: 1,
- it: 0,
- ff: 0,
- fs: 11,
- fc: 'rgb(51, 51, 51)',
- ht: 1,
- vt: 1,
- },
- },
- ],
- ch_width: 2361,
- rh_height: 936,
- universheet_select_save: [
- {
- left: 741,
- width: 138,
- top: 796,
- height: 19,
- left_move: 741,
- width_move: 138,
- top_move: 796,
- height_move: 19,
- row: [33, 33],
- column: [6, 6],
- row_focus: 33,
- column_focus: 6,
- },
- ],
- calcChain: [
- {
- r: 0,
- c: 3,
- index: '0',
- func: [true, 3, '=Formula!A1+Formula!B1'],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- ],
- scrollLeft: 0,
- scrollTop: 0,
- };
-
- const options = {
- container: 'universheet',
- lang: 'zh',
- data: [sheetCell],
- };
-
- // Transition to 3.0 configuration
- const univerData = migrate(options);
-});
diff --git a/packages/core/test/Shared/NameGen.test.ts b/packages/core/test/Shared/NameGen.test.ts
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/packages/core/test/Shared/ObjectArray.test.ts b/packages/core/test/Shared/ObjectArray.test.ts
deleted file mode 100644
index 21de9a4d8f..0000000000
--- a/packages/core/test/Shared/ObjectArray.test.ts
+++ /dev/null
@@ -1,448 +0,0 @@
-import { ObjectArray } from '../../src/Shared/ObjectArray';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('object array create', () => {
- const array = new ObjectArray({ 1: 'UniverSheet1' });
- expect(array.getLength()).toEqual(2);
- array.push({ 2: 'UniverSheet2' });
- array.push({ 3: 'UniverSheet3' });
- expect(array.getLength()).toEqual(4);
-});
-
-test('object array pop', () => {
- const array = new ObjectArray();
- expect(array.pop()).toBeNull();
- array.push('univerSheet1');
- array.push('univerSheet2');
- array.push('univerSheet3');
- array.pop();
- expect(array.get(0)).toEqual('univerSheet1');
- expect(array.get(1)).toEqual('univerSheet2');
- expect(array.get(2)).toBeUndefined();
- expect(array.getLength()).toEqual(2);
-});
-
-test('object array shift', () => {
- const array = new ObjectArray();
- expect(array.shift()).toBeNull();
-
- array.push('univerSheet1');
- array.push('univerSheet2');
- array.push('univerSheet3');
- array.shift();
-
- expect(array.get(0)).toEqual('univerSheet2');
- expect(array.get(1)).toEqual('univerSheet3');
- expect(array.get(2)).toBeUndefined();
- expect(array.getLength()).toEqual(2);
-});
-
-test('object array inserts', () => {
- const array1 = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- });
- const array2 = new ObjectArray({
- 0: 'univerSheet3',
- 1: 'univerSheet4',
- 2: 'univerSheet5',
- });
- array1.inserts(0, array2);
- expect(array1.get(0)).toEqual('univerSheet3');
- expect(array1.get(1)).toEqual('univerSheet4');
- expect(array1.get(2)).toEqual('univerSheet5');
- expect(array1.get(3)).toEqual('univerSheet0');
- expect(array1.get(4)).toEqual('univerSheet1');
- expect(array1.get(5)).toEqual('univerSheet2');
- expect(array1.getLength()).toEqual(6);
-
- const array3 = new ObjectArray();
- array3.inserts(3, array2);
- expect(array3.getLength()).toEqual(array2.getLength());
-});
-
-test('object array insert', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- 4: 'univerSheet4',
- 5: 'univerSheet5',
- });
- array.insert(1, 'univerSheetNew');
- expect(array.get(0)).toEqual('univerSheet0');
- expect(array.get(1)).toEqual('univerSheetNew');
- expect(array.get(2)).toEqual('univerSheet1');
- expect(array.get(3)).toEqual('univerSheet2');
- expect(array.get(4)).toEqual('univerSheet3');
- expect(array.get(5)).toEqual('univerSheet4');
- expect(array.get(6)).toEqual('univerSheet5');
- expect(array.getLength()).toEqual(7);
-});
-
-test('object array splice', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- 4: 'univerSheet4',
- 5: 'univerSheet5',
- 6: 'univerSheet6',
- 7: 'univerSheet7',
- 8: 'univerSheet8',
- 9: 'univerSheet9',
- 10: 'univerSheet10',
- });
- expect(array.getLength()).toEqual(11);
-
- const splice1 = array.splice(0, 2);
- expect(array.get(0)).toEqual('univerSheet2');
- expect(array.get(1)).toEqual('univerSheet3');
- expect(array.get(2)).toEqual('univerSheet4');
- expect(array.get(3)).toEqual('univerSheet5');
- expect(array.get(4)).toEqual('univerSheet6');
- expect(array.get(5)).toEqual('univerSheet7');
- expect(array.get(6)).toEqual('univerSheet8');
- expect(array.get(7)).toEqual('univerSheet9');
- expect(array.get(8)).toEqual('univerSheet10');
- expect(array.getLength()).toEqual(9);
- expect(splice1.getLength()).toEqual(2);
-
- let splice2 = array.splice(2, 3);
- expect(array.get(0)).toEqual('univerSheet2');
- expect(array.get(1)).toEqual('univerSheet3');
- expect(array.get(2)).toEqual('univerSheet7');
- expect(array.get(3)).toEqual('univerSheet8');
- expect(array.get(4)).toEqual('univerSheet9');
- expect(array.get(5)).toEqual('univerSheet10');
- expect(array.getLength()).toEqual(6);
- expect(splice2.getLength()).toEqual(3);
-
- expect(new ObjectArray().splice(0, 10)).toEqual(new ObjectArray());
-});
-
-test('object array unshift', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- });
- array.unshift('univerSheet4');
- expect(array.get(0)).toEqual('univerSheet4');
- expect(array.get(1)).toEqual('univerSheet0');
- expect(array.get(2)).toEqual('univerSheet1');
- expect(array.get(3)).toEqual('univerSheet2');
- expect(array.get(4)).toEqual('univerSheet3');
- expect(array.getLength()).toEqual(5);
-});
-
-test('object array set', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- });
- array.set(0, 'univerSheetNew0');
- array.set(1, 'univerSheetNew1');
- array.set(2, 'univerSheetNew2');
- array.set(10, 'univerSheetNew10');
- expect(array.get(0)).toEqual('univerSheetNew0');
- expect(array.get(1)).toEqual('univerSheetNew1');
- expect(array.get(2)).toEqual('univerSheetNew2');
- expect(array.get(10)).toEqual('univerSheetNew10');
- expect(array.getLength()).toEqual(11);
-});
-
-test('object array last', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- });
- expect(array.last()).toEqual('univerSheet3');
-});
-
-test('object array push', () => {
- const array = new ObjectArray();
- array.push('univerSheet0');
- array.push('univerSheet1');
- array.push('univerSheet2');
- expect(array.get(0)).toEqual('univerSheet0');
- expect(array.get(1)).toEqual('univerSheet1');
- expect(array.get(2)).toEqual('univerSheet2');
- expect(array.getLength()).toEqual(3);
-});
-
-test('object array includes', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- 4: 'univerSheet4',
- 5: 'univerSheet5',
- });
- expect(array.includes('univerSheet0')).toBeTruthy();
- expect(array.includes('univerSheet10')).toBeFalsy();
-});
-
-test('object array slice', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- 4: 'univerSheet4',
- 5: 'univerSheet5',
- });
- let slice = array.slice(1, 4);
- expect(slice.get(0)).toEqual('univerSheet1');
- expect(slice.get(1)).toEqual('univerSheet2');
- expect(slice.get(2)).toEqual('univerSheet3');
- expect(slice.getLength()).toEqual(3);
-
- expect(new ObjectArray().slice(0, 10)).toEqual(new ObjectArray());
-});
-
-test('object array concat', () => {
- const array1 = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- });
- const array2 = new ObjectArray({
- 0: 'univerSheet3',
- 1: 'univerSheet4',
- 2: 'univerSheet5',
- });
- const array3 = array1.concat(array2);
- expect(array3.get(0)).toEqual('univerSheet0');
- expect(array3.get(1)).toEqual('univerSheet1');
- expect(array3.get(2)).toEqual('univerSheet2');
- expect(array3.get(3)).toEqual('univerSheet3');
- expect(array3.get(4)).toEqual('univerSheet4');
- expect(array3.get(5)).toEqual('univerSheet5');
- expect(array3.getLength()).toEqual(6);
-});
-
-test('object array delete', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- });
- array.delete(0);
- expect(array.get(0)).toEqual('univerSheet1');
- expect(array.get(1)).toEqual('univerSheet2');
- expect(array.get(2)).toEqual('univerSheet3');
- expect(array.getLength()).toEqual(3);
-});
-
-test('object array find', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- });
- const find1 = array.find((k, v) => v === 'univerSheet1');
- const find2 = array.find((k, v) => v === 'univerSheet100');
- expect(find1).toEqual('univerSheet1');
- expect(find2).toEqual(null);
-});
-
-test('object array findIndex', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- });
- const find1 = array.findIndex((k, v) => v === 'univerSheet1');
- const find2 = array.findIndex((k, v) => v === 'test1');
- expect(find1).toEqual(1);
- expect(find2).toEqual(-1);
-});
-
-test('object array map', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- });
- const find = array.map((v) => `${v}-new`);
- expect(find.get(0)).toEqual('univerSheet0-new');
- expect(find.get(1)).toEqual('univerSheet1-new');
- expect(find.get(2)).toEqual('univerSheet2-new');
- expect(find.get(3)).toEqual('univerSheet3-new');
- expect(find.getLength()).toEqual(4);
-});
-
-test('object array filter', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- });
- const find = array.filter((k, v) => k > 1);
- expect(find.get(0)).toEqual('univerSheet2');
- expect(find.get(1)).toEqual('univerSheet3');
- expect(find.getLength()).toEqual(2);
-});
-
-test('object array iterator', () => {
- const array = new ObjectArray<string>({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- });
- for (let item of array) {
- console.log(item);
- }
-});
-
-test('object array forEach', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- });
- array.forEach((k, v) => {
- if (v === 'univerSheet2') return false;
- });
-});
-
-test('object array bigData', () => {
- console.time();
- const array = new ObjectArray<number>(1000000);
- for (let i = 0; i < 1000000; i++) {
- array.set(i, i);
- }
- console.timeEnd();
-});
-
-test('native array bigData', () => {
- console.time();
- const array = new Array<number>(1000000);
- for (let i = 0; i < 1000000; i++) {
- array.push(i);
- }
- console.timeEnd();
-});
-
-test('object array delete bug 001', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- 4: 'univerSheet4',
- 5: 'univerSheet5',
- 6: 'univerSheet6',
- 7: 'univerSheet7',
- 8: 'univerSheet8',
- 9: 'univerSheet9',
- 10: 'univerSheet10',
- });
- array.delete(array.getLength() - 1);
- array.delete(array.getLength() - 1);
- array.delete(array.getLength() - 1);
- array.delete(array.getLength() - 1);
- array.delete(array.getLength() - 1);
- array.delete(array.getLength() - 1);
- array.delete(array.getLength() - 1);
- array.delete(array.getLength() - 1);
- array.delete(array.getLength() - 1);
- array.delete(array.getLength() - 1);
- array.delete(array.getLength() - 1);
- expect(array.getLength()).toEqual(0);
-});
-
-test('object array delete bug 002', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- 4: 'univerSheet4',
- 5: 'univerSheet5',
- 6: 'univerSheet6',
- 7: 'univerSheet7',
- 8: 'univerSheet8',
- 9: 'univerSheet9',
- 10: 'univerSheet10',
- });
- array.delete(8);
- expect(array.get(8)).toEqual('univerSheet9');
-});
-
-test('object array clone', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- 4: 'univerSheet4',
- 5: 'univerSheet5',
- 6: 'univerSheet6',
- 7: 'univerSheet7',
- 8: 'univerSheet8',
- 9: 'univerSheet9',
- 10: 'univerSheet10',
- });
- expect(array.clone()).toEqual(array);
- expect(
- array.clone((v) => (v === 'univerSheet0' ? 'univerSheet100' : v)).get(0)
- ).toEqual('univerSheet100');
-});
-
-test('object array clear', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- 4: 'univerSheet4',
- 5: 'univerSheet5',
- 6: 'univerSheet6',
- 7: 'univerSheet7',
- 8: 'univerSheet8',
- 9: 'univerSheet9',
- 10: 'univerSheet10',
- });
- expect(array.getSizeOf()).toEqual(11);
- array.clear();
- expect(array.getSizeOf()).toEqual(0);
-});
-
-test('object array forOf', () => {
- const array = new ObjectArray({
- 0: 'univerSheet0',
- 1: 'univerSheet1',
- 2: 'univerSheet2',
- 3: 'univerSheet3',
- 4: 'univerSheet4',
- 5: 'univerSheet5',
- 6: 'univerSheet6',
- 7: 'univerSheet7',
- 8: 'univerSheet8',
- 9: 'univerSheet9',
- 10: 'univerSheet10',
- });
- const iterator = array[Symbol.iterator]()[Symbol.iterator]();
- for (let val of array) {
- console.log(val);
- }
-});
diff --git a/packages/core/test/Shared/ObjectMatrix.test.ts b/packages/core/test/Shared/ObjectMatrix.test.ts
deleted file mode 100644
index d4b2cd8f2e..0000000000
--- a/packages/core/test/Shared/ObjectMatrix.test.ts
+++ /dev/null
@@ -1,257 +0,0 @@
-import { ObjectMatrix } from '../../src/Shared/ObjectMatrix';
-import { ObjectArray } from '../../src/Shared/ObjectArray';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Test ObjectMatrix getLength', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getLength()).toEqual(3);
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getLength()).toEqual(4);
-});
-
-test('Test ObjectMatrix getRow', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getRow(0)).not.toBeUndefined();
- expect(matrix.getRow(1)).not.toBeUndefined();
- expect(matrix.getRow(2)).not.toBeUndefined();
- expect(matrix.getRow(3)).toBeUndefined();
-});
-
-test('Test ObjectMatrix insertRow', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getRow(0)).not.toBeUndefined();
- expect(matrix.getRow(1)).not.toBeUndefined();
- expect(matrix.getRow(2)).not.toBeUndefined();
- expect(matrix.getRow(3)).toBeUndefined();
-});
-
-test('Test ObjectMatrix getRowOrCreate', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getRowOrCreate(0)).not.toBeUndefined();
- expect(matrix.getRowOrCreate(1)).not.toBeUndefined();
- expect(matrix.getRowOrCreate(2)).not.toBeUndefined();
- expect(matrix.getRowOrCreate(3)).not.toBeUndefined();
-});
-
-test('Test ObjectMatrix swapRow', () => {
- const matrix = new ObjectMatrix();
- const srcRow = new ObjectArray({ 0: 0, 1: 1 });
- const disRow = new ObjectArray({ 0: 0, 1: 1 });
- matrix.insertRow(0, srcRow);
- matrix.insertRow(1, disRow);
- expect(matrix.getRow(0) === srcRow).toBeTruthy();
- expect(matrix.getRow(1) === disRow).toBeTruthy();
- matrix.swapRow(0, 1);
- expect(matrix.getRow(1) === srcRow).toBeTruthy();
- expect(matrix.getRow(0) === disRow).toBeTruthy();
-});
-
-test('Test ObjectMatrix toArray', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.toArray().length).toEqual(3);
-});
-
-test('Test ObjectMatrix getValue', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getValue(0, 0)).toEqual(0);
-});
-
-test('Test ObjectMatrix DeleteValue', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getValue(0, 0)).toEqual(0);
- matrix.deleteValue(0, 0);
- expect(matrix.getValue(0, 0)).toEqual(1);
-});
-
-test('Test ObjectMatrix spliceRows', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
-});
-
-test('Test ObjectMatrix insertRow', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getLength()).toEqual(3);
-});
-
-test('Test ObjectMatrix forEach', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.forEach((k, v) => k <= 1);
-});
-
-test('Test ObjectMatrix BigData', () => {
- console.time();
- const matrix = new ObjectMatrix();
- for (let i = 0; i < 100000; i++) {
- matrix.insertRow(i, new ObjectArray());
- }
- console.timeEnd();
-});
-
-test('Test rest', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getLength()).toEqual(6);
- matrix.reset();
- expect(matrix.getLength()).toEqual(0);
-});
-
-test('Test hasValue', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.hasValue()).toEqual(true);
- matrix.reset();
- expect(matrix.hasValue()).toEqual(false);
-});
-
-test('Test getMatrix', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getMatrix()).not.toBeUndefined();
-});
-
-test('Test setValue', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.setValue(0, 0, 10);
- expect(matrix.getValue(0, 0)).toEqual(10);
-});
-
-test('Test pushRow', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getLength()).toEqual(6);
- matrix.pushRow(new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getLength()).toEqual(7);
-});
-
-test('Test insertRows', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
-
- const matrix1 = new ObjectMatrix();
- matrix1.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix1.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix1.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix1.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix1.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix1.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
-
- matrix.insertRows(0, matrix1);
- expect(matrix.getLength()).toEqual(12);
-});
-
-test('Test getFragments', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
-
- const fragment = matrix.getFragments(0, 1, 0, 1);
- expect(fragment).not.toBeUndefined();
-});
-
-test('Test getSizeOf', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getSizeOf()).toEqual(6);
-});
-
-test('Test getRange', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getRange()).not.toBeUndefined();
-});
-
-test('Test toJSON', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.toJSON()).not.toBeUndefined();
-});
-
-test('Test getData', () => {
- const matrix = new ObjectMatrix();
- matrix.insertRow(0, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(1, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(2, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(3, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(4, new ObjectArray({ 0: 0, 1: 1 }));
- matrix.insertRow(5, new ObjectArray({ 0: 0, 1: 1 }));
- expect(matrix.getData()).not.toBeUndefined();
-});
diff --git a/packages/core/test/Shared/RectTree.test.ts b/packages/core/test/Shared/RectTree.test.ts
deleted file mode 100644
index 9d53ebec84..0000000000
--- a/packages/core/test/Shared/RectTree.test.ts
+++ /dev/null
@@ -1,255 +0,0 @@
-import { RectTree } from '../../src/Shared/RectTree/RectTree';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('Test RectTree insert', () => {
- const tree = new RectTree();
- const node1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 10,
- maxX: 10,
- });
- const node2 = new RectTree.Node({
- minY: 11,
- minX: 11,
- maxY: 20,
- maxX: 20,
- });
- const node3 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 5,
- maxX: 5,
- });
- tree.insert(node1);
- tree.insert(node2);
- tree.insert(node3);
-});
-
-test('Test RectTree load', () => {
- const tree = new RectTree();
- const node1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 10,
- maxX: 10,
- });
- const node2 = new RectTree.Node({
- minY: 11,
- minX: 11,
- maxY: 20,
- maxX: 20,
- });
- tree.load([node1, node2]);
-
- const find1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 50,
- maxX: 50,
- });
-
- const res1 = tree.search(find1);
- expect(res1.length).toEqual(2);
-});
-
-test('Test RectTree search', () => {
- const tree = new RectTree();
- const node1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 10,
- maxX: 10,
- });
- const node2 = new RectTree.Node({
- minY: 11,
- minX: 11,
- maxY: 20,
- maxX: 20,
- });
- tree.insert(node1);
- tree.insert(node2);
-
- const find1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 5,
- maxX: 5,
- });
- const find2 = new RectTree.Node({
- minY: 11,
- minX: 11,
- maxY: 30,
- maxX: 30,
- });
- const find3 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 30,
- maxX: 30,
- });
-
- const res1 = tree.search(find1);
- const res2 = tree.search(find2);
- const res3 = tree.search(find3);
-
- expect(res1.length).toEqual(1);
- expect(res2.length).toEqual(1);
- expect(res3.length).toEqual(2);
-
- expect(res1[0]).toEqual(node1);
- expect(res2[0]).toEqual(node2);
- expect(res3[0]).toEqual(node1);
- expect(res3[1]).toEqual(node2);
-});
-
-test('Test RectTree clear', () => {
- const tree = new RectTree();
- const node1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 10,
- maxX: 10,
- });
- const node2 = new RectTree.Node({
- minY: 11,
- minX: 11,
- maxY: 20,
- maxX: 20,
- });
- tree.load([node1, node2]);
-
- const find1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 50,
- maxX: 50,
- });
- const res1 = tree.search(find1);
- expect(res1.length).toEqual(2);
-
- tree.clear();
-
- const find2 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 50,
- maxX: 50,
- });
- const res2 = tree.search(find2);
- expect(res2.length).toEqual(0);
-});
-
-test('Test RectTree collides', () => {
- const tree = new RectTree();
- const node1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 10,
- maxX: 10,
- });
- const node2 = new RectTree.Node({
- minY: 11,
- minX: 11,
- maxY: 20,
- maxX: 20,
- });
- tree.insert(node1);
- tree.insert(node2);
-
- const find1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 5,
- maxX: 5,
- });
- const find2 = new RectTree.Node({
- minY: 11,
- minX: 11,
- maxY: 30,
- maxX: 30,
- });
- const find3 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 30,
- maxX: 30,
- });
- const find4 = new RectTree.Node({
- minY: 100,
- minX: 100,
- maxY: 130,
- maxX: 130,
- });
-
- const res1 = tree.collides(find1);
- const res2 = tree.collides(find2);
- const res3 = tree.collides(find3);
- const res4 = tree.collides(find4);
-
- expect(res1).toEqual(true);
- expect(res2).toEqual(true);
- expect(res3).toEqual(true);
- expect(res4).toEqual(false);
-});
-
-test('Test RectTree first', () => {
- const tree = new RectTree();
- const node1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 10,
- maxX: 10,
- });
- const node2 = new RectTree.Node({
- minY: 11,
- minX: 11,
- maxY: 20,
- maxX: 20,
- });
- tree.insert(node1);
- tree.insert(node2);
-
- const find1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 5,
- maxX: 5,
- });
- const res1 = tree.first(find1);
- expect(res1).toEqual(node1);
-});
-
-test('Test RectTree Remove', () => {
- const tree = new RectTree();
- const node1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 10,
- maxX: 10,
- });
- const node2 = new RectTree.Node({
- minY: 11,
- minX: 11,
- maxY: 20,
- maxX: 20,
- });
- tree.insert(node1);
- tree.insert(node2);
-
- const find1 = new RectTree.Node({
- minY: 0,
- minX: 0,
- maxY: 50,
- maxX: 50,
- });
-
- const res1 = tree.search(find1);
- expect(res1.length).toEqual(2);
-
- tree.remove(node1);
-
- const res2 = tree.search(find1);
- expect(res2.length).toEqual(1);
-});
diff --git a/packages/core/test/Shared/Tools.test.ts b/packages/core/test/Shared/Tools.test.ts
deleted file mode 100644
index 2efe16a424..0000000000
--- a/packages/core/test/Shared/Tools.test.ts
+++ /dev/null
@@ -1,372 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { Tools } from '../../src/Shared/Tools';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('sheet Utils stringat', () => {
- expect(Tools.stringAt(2)).toEqual('C');
- expect(Tools.stringAt(30)).toEqual('undefinedE');
-});
-
-test('sheet Utils getEnvironment', () => {
- expect(Tools.getEnvironment().app_version).toEqual('4.0');
-});
-
-test('sheet Utils indexAt', () => {
- expect(Tools.indexAt('CE')).toEqual(82);
-});
-
-test('sheet Utils deleteBlank', () => {
- expect(Tools.deleteBlank('a b')).toEqual('ab');
- expect(Tools.deleteBlank()).toEqual(undefined);
-});
-
-test('sheet Utils getSystemType', () => {
- Object.defineProperty(global.navigator, 'platform', {
- value: 'Mac68K',
- configurable: true,
- });
- expect(Tools.getSystemType()).toEqual('Mac');
- Object.defineProperty(global.navigator, 'platform', {
- value: 'X11',
- configurable: true,
- });
- expect(Tools.getSystemType()).toEqual('Unix');
- Object.defineProperty(global.navigator, 'platform', {
- value: 'Linux',
- configurable: true,
- });
- expect(Tools.getSystemType()).toEqual('Linux');
- Object.defineProperty(global.navigator, 'platform', {
- value: 'Win32',
- configurable: true,
- });
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Windows 2000',
- configurable: true,
- });
- expect(Tools.getSystemType()).toEqual('Windows 2000');
- Object.defineProperty(global.navigator, 'platform', {
- value: 'Win32',
- configurable: true,
- });
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Windows XP',
- configurable: true,
- });
- expect(Tools.getSystemType()).toEqual('Windows XP');
- Object.defineProperty(global.navigator, 'platform', {
- value: 'Win32',
- configurable: true,
- });
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Windows 2003',
- configurable: true,
- });
- expect(Tools.getSystemType()).toEqual('Windows 2003');
- Object.defineProperty(global.navigator, 'platform', {
- value: 'Win32',
- configurable: true,
- });
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Windows Vista',
- configurable: true,
- });
- expect(Tools.getSystemType()).toEqual('Windows Vista');
- Object.defineProperty(global.navigator, 'platform', {
- value: 'Win32',
- configurable: true,
- });
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Windows 7',
- configurable: true,
- });
- expect(Tools.getSystemType()).toEqual('Windows 7');
- Object.defineProperty(global.navigator, 'platform', {
- value: 'Win32',
- configurable: true,
- });
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Windows 10',
- configurable: true,
- });
- expect(Tools.getSystemType()).toEqual('Windows 10');
- Object.defineProperty(global.navigator, 'platform', {
- value: 'Win32',
- configurable: true,
- });
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Windows 11',
- configurable: true,
- });
- expect(Tools.getSystemType()).toEqual('Windows 11');
- Object.defineProperty(global.navigator, 'userAgent', {
- value: '',
- configurable: true,
- });
- expect(Tools.getSystemType()).toEqual('Unknown system');
-});
-
-test('sheet Utils getBrowserType', () => {
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Opera',
- configurable: true,
- });
- expect(Tools.getBrowserType()).toEqual('Opera');
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Trident rv:11.0',
- configurable: true,
- });
- expect(Tools.getBrowserType()).toEqual('IE11');
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Edge',
- configurable: true,
- });
- expect(Tools.getBrowserType()).toEqual('Edge');
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Firefox',
- configurable: true,
- });
- expect(Tools.getBrowserType()).toEqual('FF');
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Safari',
- configurable: true,
- });
- expect(Tools.getBrowserType()).toEqual('Safari');
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Safari Chrome',
- configurable: true,
- });
- expect(Tools.getBrowserType()).toEqual('Chrome');
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'compatible; MSIE 7.0;',
- configurable: true,
- });
- expect(Tools.getBrowserType()).toEqual('IE7');
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'compatible; MSIE 8.0;',
- configurable: true,
- });
- expect(Tools.getBrowserType()).toEqual('IE8');
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'compatible; MSIE 9.0;',
- configurable: true,
- });
- expect(Tools.getBrowserType()).toEqual('IE9');
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'compatible; MSIE 10.0;',
- configurable: true,
- });
- expect(Tools.getBrowserType()).toEqual('IE10');
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'MSIE7',
- configurable: true,
- });
- expect(Tools.getBrowserType()).toEqual('Unknown browser');
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'compatible; MSIE 5.0;',
- configurable: true,
- });
- expect(Tools.getBrowserType()).toEqual('0');
-});
-
-test('sheet Utils number check', () => {
- expect(Tools.isNumber([])).toBeFalsy();
- expect(Tools.isNumber({})).toBeFalsy();
- expect(Tools.isNumber(() => {})).toBeFalsy();
- expect(Tools.isNumber(undefined)).toBeFalsy();
- expect(Tools.isNumber(null)).toBeFalsy();
- expect(Tools.isNumber(0)).toBeTruthy();
- expect(Tools.isNumber(1212)).toBeTruthy();
- expect(Tools.isNumber(false)).toBeFalsy();
-});
-
-test('sheet Utils blank check', () => {
- expect(Tools.isBlank([])).toBeFalsy();
- expect(Tools.isBlank({})).toBeFalsy();
- expect(Tools.isBlank(() => {})).toBeFalsy();
- expect(Tools.isBlank(0)).toBeFalsy();
- expect(Tools.isBlank(1212)).toBeFalsy();
- expect(Tools.isBlank(false)).toBeFalsy();
- expect(Tools.isBlank(undefined)).toBeTruthy();
- expect(Tools.isBlank(null)).toBeTruthy();
- expect(Tools.isBlank('')).toBeTruthy();
- expect(Tools.isBlank(' ')).toBeTruthy();
- expect(Tools.isBlank(' ')).toBeTruthy();
-});
-
-test('sheet Utils plain object', () => {
- class GC {}
- expect(Tools.isPlainObject(new GC())).toBeFalsy();
- expect(Tools.isPlainObject({})).toBeTruthy();
- // eslint-disable-next-line no-new-object
- expect(Tools.isPlainObject(new Object())).toBeTruthy();
-});
-
-test('sheet Utils deepMerge', () => {
- const object = {
- zh: 'zh',
- en: 'en',
- array: [1, 2, 3],
- object: { key: 'key' },
- };
- const clone = Tools.deepMerge({}, object);
- expect(clone).toEqual(object);
- expect(clone.array === object.array).toBeFalsy();
- expect(clone.object === object.object).toBeFalsy();
- const arr = [[[1]], [[2]]];
- const arrClone = Tools.deepMerge([], arr);
- expect(arrClone === arr).toBeFalsy();
- const arr1 = [{ a: [1, 2] }];
- const arr1Clone = Tools.deepMerge([], arr1);
- expect(arr1Clone === arr1).toBeFalsy();
-});
-
-test('sheet Utils deepClone', () => {
- const object = {
- zh: 'zh',
- en: 'en',
- array: [1, 2, 3],
- object: { key: 'key' },
- };
- const clone = Tools.deepClone(object);
- expect(clone).toEqual(object);
- expect(clone.array === object.array).toBeFalsy();
- expect(clone.object === object.object).toBeFalsy();
- const reg = /test/;
- expect(Tools.deepClone(reg).test('test')).toEqual(true);
- expect(Tools.deepClone(new Date('1993')).getDate()).toEqual(1);
-});
-
-test('sheet Utils diffValue', () => {
- expect(Tools.diffValue(null, undefined)).toBeFalsy();
- expect(Tools.diffValue([], {})).toBeFalsy();
- expect(Tools.diffValue(1, '')).toBeFalsy();
- expect(Tools.diffValue(1, 1)).toBeTruthy();
- expect(Tools.diffValue(/s/, /s/)).toBeTruthy();
- expect(Tools.diffValue('s', 's')).toBeTruthy();
- expect(
- Tools.diffValue(new Date('2020/11/11'), new Date('2020/11/11'))
- ).toBeTruthy();
- expect(Tools.diffValue({ a: 1 }, { a: 1 })).toBeTruthy();
- expect(
- Tools.diffValue({ a: { b: 2, c: [1, 2, 3] } }, { a: { b: 2, c: [1, 2, 3] } })
- ).toBeTruthy();
- expect(
- Tools.diffValue({ a: { b: 2, c: [1, 2, 3] } }, { a: { b: 2, c: [1, 2, 4] } })
- ).toBeFalsy();
- expect(Tools.diffValue([1, 2, 3, 5], [1, 2, 3, 5])).toBeTruthy();
- expect(Tools.diffValue([1, 2, 3, 5], [1, 2, 8, 5])).toBeFalsy();
- expect(
- Tools.diffValue(
- [1, { b: 2, c: [1, 2, 3] }, 3, 5],
- [1, { b: 2, c: [1, 2, 3] }, 3, 5]
- )
- ).toBeTruthy();
-});
-
-test('sheet Utils isBoolean', () => {
- const a = true;
- expect(Tools.isBoolean(true)).toEqual(true);
-});
-
-test('sheet Utils isFunction', () => {
- const a = () => {};
- expect(Tools.isFunction(a)).toEqual(true);
-});
-
-test('sheet Utils hasLength', () => {
- const a = 'abc';
- expect(Tools.hasLength(a)).toEqual(true);
- const b = 'abc';
- expect(Tools.hasLength(b, 5)).toEqual(false);
-});
-
-test('sheet Utils capitalize', () => {
- const a = 'abc';
- expect(Tools.capitalize(a)).toEqual('Abc');
-});
-
-test('sheet Utils camelCase', () => {
- const a = 'ab-c';
- expect(Tools.camelCase(a)).toEqual('abC');
-});
-
-test('sheet Utils ABCatNum', () => {
- const a = '';
- expect(Tools.ABCatNum(a)).toEqual(NaN);
- const b = '`';
- expect(Tools.ABCatNum(b)).toEqual(NaN);
-});
-
-test('sheet Utils chatAtABC', () => {
- expect(Tools.chatAtABC(2)).toEqual('C');
-});
-
-test('sheet Utils itCount', () => {
- Tools.itCount(2)();
-});
-
-test('sheet Utils isAndroid', () => {
- Object.defineProperty(global.navigator, 'userAgent', { value: 'Android' });
- expect(Tools.isAndroid()).toEqual(true);
-});
-
-test('sheet Utils isTablet', () => {
- Object.defineProperty(global.navigator, 'userAgent', { value: 'ipad' });
- expect(Tools.isTablet()).toEqual(true);
-});
-
-test('sheet Utils isWeChat', () => {
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'micromessenger',
- });
- expect(Tools.isWeChat()).toEqual(true);
-});
-
-test('sheet Utils isIphone', () => {
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'iPhone',
- });
- expect(Tools.isIPhone()).toEqual(true);
-});
-
-test('sheet Utils isIEBrowser', () => {
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;',
- });
- expect(Tools.isIEBrowser()).toEqual(true);
-});
-
-test('sheet Utils isMobile', () => {
- Object.defineProperty(global.navigator, 'userAgent', {
- value: 'Android',
- });
- expect(Tools.isMobile()).toEqual(true);
- Object.defineProperty(document.body, 'clientWidth', {
- value: '300',
- });
- Object.defineProperty(document.body, 'clientHeight', {
- value: '400',
- });
- expect(Tools.isMobile()).toEqual(true);
-});
-
-test('sheet Utils fillTwoDimensionalArray', () => {
- const a = Tools.fillTwoDimensionalArray(3, 3, '3');
- expect(a.length).toEqual(3);
-});
-
-test('sheet Utils diffArrays', () => {
- expect(Tools.diffValue([1], [1, 2])).toEqual(false);
-});
-
-test('sheet Utils getLanguage', () => {
- Object.defineProperty(global, 'navigator', {
- value: null,
- configurable: true,
- });
- expect(Tools.getLanguage()).toEqual('en-US');
-});
diff --git a/packages/core/test/Shared/Tuples.test.ts b/packages/core/test/Shared/Tuples.test.ts
deleted file mode 100644
index 115ceaa8d9..0000000000
--- a/packages/core/test/Shared/Tuples.test.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { Tuples } from '../../src/Shared/Tuples';
-
-jest.mock('nanoid', () => ({ nanoid: () => '12345678' }));
-
-test('checkup', () => {
- const test = (...argument: any) =>
- Tuples.checkup(
- argument,
- Tuples.BOOLEAN_TYPE,
- Tuples.STRING_TYPE,
- Tuples.NUMBER_TYPE,
- Tuples.FUNCTION_TYPE
- );
- expect(test(false, '1', 1, () => {})).toEqual(true);
- const test1 = (...argument: any) =>
- Tuples.checkup(argument, Tuples.BOOLEAN_TYPE);
- expect(test1('1')).toEqual(false);
- const test2 = (...argument: any) => Tuples.checkup(argument, Tuples.STRING_TYPE);
- expect(test2(1)).toEqual(false);
- const test3 = (...argument: any) => Tuples.checkup(argument, Tuples.NUMBER_TYPE);
- expect(test3('1')).toEqual(false);
- const test4 = (...argument: any) =>
- Tuples.checkup(argument, Tuples.FUNCTION_TYPE);
- expect(test4('1')).toEqual(false);
- const test5 = (...argument: any) => Tuples.checkup(argument, Tuples.OBJECT_TYPE);
- expect(test5('1')).toEqual(false);
-});
diff --git a/packages/sheets-plugin-find/src/View/UI/FindModal.tsx b/packages/sheets-plugin-find/src/View/UI/FindModal.tsx
index ed84c74075..b26f20d362 100644
--- a/packages/sheets-plugin-find/src/View/UI/FindModal.tsx
+++ b/packages/sheets-plugin-find/src/View/UI/FindModal.tsx
@@ -1,6 +1,7 @@
-import { BaseCheckboxGroupOptions, BaseComponentProps, Button, CellRange, CheckboxGroup, Icon, Input, Modal, Select, CustomLabel } from '@univerjs/base-ui';
-import { Component, createRef } from 'react';
+import { BaseCheckboxGroupOptions, BaseComponentProps, Button, CellRange, CheckboxGroup, CustomLabel, Icon, Input, Modal, Select } from '@univerjs/base-ui';
import { BaseItemProps } from '@univerjs/base-ui/src/Components/Item/Item';
+import { Component, createRef } from 'react';
+
import styles from './index.module.less';
type searchResult = {
@@ -27,6 +28,7 @@ interface IState {
current: number;
count: number;
replaceCount: number;
+ value: string;
}
export enum SelectSearch {
@@ -36,9 +38,6 @@ export enum SelectSearch {
}
export class FindModal extends Component<IProps, IState> {
- private _searchRef = createRef();
-
- private _replaceRef = createRef();
private _matchGroup: BaseCheckboxGroupOptions[] = [];
@@ -53,6 +52,7 @@ export class FindModal extends Component<IProps, IState> {
current: 0,
count: 0,
replaceCount: 0,
+ value: '',
};
this._matchGroup = [
@@ -141,7 +141,7 @@ export class FindModal extends Component<IProps, IState> {
}
findNext() {
- const value = this._searchRef.current.getValue();
+ const value = this.state.value;
if (!value) return;
const { count, current } = this.props.findNext(value);
this.setState({
@@ -151,7 +151,7 @@ export class FindModal extends Component<IProps, IState> {
}
findPrevious() {
- const value = this._searchRef.current.getValue();
+ const value = this.state.value;
if (!value) return;
const { count, current } = this.props.findPrevious(value);
this.setState({
@@ -161,7 +161,7 @@ export class FindModal extends Component<IProps, IState> {
}
replaceText() {
- const value = this._replaceRef.current.getValue();
+ const value = this.state.value;
if (!value) return;
const replaceCount = this.props.replaceText(value);
this.setState({
@@ -170,7 +170,7 @@ export class FindModal extends Component<IProps, IState> {
}
replaceAll() {
- const value = this._replaceRef.current.getValue();
+ const value = this.state.value;
if (!value) return;
const replaceCount = this.props.replaceAll(value);
this.setState({
@@ -178,6 +178,13 @@ export class FindModal extends Component<IProps, IState> {
});
}
+ onChange(e) {
+ const value = e.target.value;
+ this.setState({
+ value,
+ });
+ }
+
/**
* Render the component's HTML
*
@@ -202,7 +209,7 @@ export class FindModal extends Component<IProps, IState> {
<CustomLabel label="find.find" />
</span>
)}
- <Input ref={this._searchRef} onPressEnter={this.findNext.bind(this)}></Input>
+ <Input onPressEnter={this.findNext.bind(this)} onChange={(e) => this.onChange(e)}></Input>
{count ? (
<div className={styles.count}>
<span onClick={this.findPrevious.bind(this)}>
@@ -226,7 +233,7 @@ export class FindModal extends Component<IProps, IState> {
<span>
<CustomLabel label="find.replaceWith" />
</span>
- <Input ref={this._replaceRef}></Input>
+ <Input></Input>
</div>
<div className={styles.box}>
<span>
diff --git a/packages/sheets-plugin-find/src/View/UI/LocationContent.tsx b/packages/sheets-plugin-find/src/View/UI/LocationContent.tsx
index 739da28fa8..ff6e4c81b8 100644
--- a/packages/sheets-plugin-find/src/View/UI/LocationContent.tsx
+++ b/packages/sheets-plugin-find/src/View/UI/LocationContent.tsx
@@ -19,11 +19,7 @@ type LabelProps = {
export class LocationContent extends Component<LocationProps, LocationState> {
// private _localeObserver: Nullable<Observer<Workbook>>;
- // Render: BaseComponentRender;
-
// initialize() {
- // const component = new SheetPlugin().getPluginByName<BaseComponentSheet>('ComponentSheet')!;
- // this.Render = component.getComponentRender();
// this.state = {
// radioGroup: [],
// active: '1',
diff --git a/packages/sheets-plugin-find/src/View/UI/SearchContent.tsx b/packages/sheets-plugin-find/src/View/UI/SearchContent.tsx
index 5b56139510..2acd757c79 100644
--- a/packages/sheets-plugin-find/src/View/UI/SearchContent.tsx
+++ b/packages/sheets-plugin-find/src/View/UI/SearchContent.tsx
@@ -25,11 +25,8 @@ type LabelProps = {
};
export class SearchContent extends Component<SearchProps, SearchState> {
- // Render: BaseComponentRender;
// initialize() {
- // const component = this._context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;
- // this.Render = component.getComponentRender();
// this.state = {
// tab: [],
// content: [],
diff --git a/packages/sheets-plugin-find/src/View/UI/test.js b/packages/sheets-plugin-find/src/View/UI/test.js
deleted file mode 100644
index 93a5f227b2..0000000000
--- a/packages/sheets-plugin-find/src/View/UI/test.js
+++ /dev/null
@@ -1,7053 +0,0 @@
-window.sheetFormula = {
- name: 'Formula',
- color: '',
- config: {
- merge: {
- '12_2': {
- rs: 1,
- cs: 6,
- r: 12,
- c: 2,
- },
- '19_2': {
- rs: 1,
- cs: 6,
- r: 19,
- c: 2,
- },
- '20_6': {
- rs: 1,
- cs: 5,
- r: 20,
- c: 6,
- },
- '22_6': {
- rs: 1,
- cs: 2,
- r: 22,
- c: 6,
- },
- '23_6': {
- rs: 1,
- cs: 2,
- r: 23,
- c: 6,
- },
- '28_2': {
- rs: 1,
- cs: 6,
- r: 28,
- c: 2,
- },
- '31_6': {
- rs: 1,
- cs: 3,
- r: 31,
- c: 6,
- },
- '33_6': {
- rs: 1,
- cs: 3,
- r: 33,
- c: 6,
- },
- '35_6': {
- rs: 1,
- cs: 3,
- r: 35,
- c: 6,
- },
- '37_6': {
- rs: 1,
- cs: 3,
- r: 37,
- c: 6,
- },
- '29_6': {
- r: 29,
- c: 6,
- rs: 1,
- cs: 3,
- },
- },
- rowlen: {},
- columnlen: {
- 0: 111,
- 2: 105,
- 3: 82,
- 4: 71,
- 5: 84,
- 6: 123,
- 7: 48,
- 8: 192,
- 9: 56,
- 10: 56,
- },
- },
- index: '1',
- chart: [],
- order: '1',
- column: 18,
- row: 45,
- celldata: [
- {
- r: 0,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 1,
- c: 0,
- v: {
- v: 'Basics Function',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Basics Function',
- bg: null,
- bl: 1,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 1,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 1,
- c: 2,
- v: {
- v: 'Name',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Name',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 1,
- c: 3,
- v: {
- v: 'Age',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Age',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 1,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 1,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 1,
- c: 6,
- v: {
- v: 'Indirect Function',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Indirect Function',
- bg: null,
- bl: 1,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 1,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 1,
- c: 8,
- v: {
- v: 'J2',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'J2',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 1,
- c: 9,
- v: {
- v: 1,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '1',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 1,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 2,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 2,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 2,
- c: 2,
- v: {
- v: 'Jack',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Jack',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 2,
- c: 3,
- v: {
- v: 17,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '17',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 2,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 2,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 2,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 2,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 2,
- c: 8,
- v: {
- v: 'I',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'I',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 2,
- c: 9,
- v: {
- v: 2,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '2',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 2,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 3,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 3,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 3,
- c: 2,
- v: {
- v: 'Lily',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Lily',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 3,
- c: 3,
- v: {
- v: 23,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '23',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 3,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 3,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 3,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 3,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 3,
- c: 8,
- v: {
- v: 'J',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'J',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 3,
- c: 9,
- v: {
- v: 3,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '3',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 3,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 4,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 4,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 4,
- c: 2,
- v: {
- v: 'Bob',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Bob',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 4,
- c: 3,
- v: {
- v: 30,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '30',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 4,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 4,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 4,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 4,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 4,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 4,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 4,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 5,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 5,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 5,
- c: 2,
- v: {
- v: 'Mary',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Mary',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 5,
- c: 3,
- v: {
- v: 25,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '25',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 5,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 5,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 5,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 5,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 5,
- c: 8,
- v: {
- v: '=INDIRECT("I2")',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: '=INDIRECT("I2")',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 5,
- c: 9,
- v: {
- v: 'J2',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'J2',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=INDIRECT("I2")',
- },
- },
- {
- r: 5,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 6,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 6,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 6,
- c: 2,
- v: {
- v: 'Average Age:',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Average Age:',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 6,
- c: 3,
- v: {
- v: 23.75,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '23.75',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=AVERAGE(D3:D6)',
- },
- },
- {
- r: 6,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 6,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 6,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 6,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 6,
- c: 8,
- v: {
- v: '=INDIRECT(I2)',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: '=INDIRECT(I2)',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 6,
- c: 9,
- v: {
- v: 1,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '1',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=INDIRECT(I2)',
- },
- },
- {
- r: 6,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 7,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 7,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 7,
- c: 2,
- v: {
- v: 'Max Age:',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Max Age:',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 7,
- c: 3,
- v: {
- v: 30,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '30',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=MAX(D3:D6)',
- },
- },
- {
- r: 7,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 7,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 7,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 7,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 7,
- c: 8,
- v: {
- v: '=INDIRECT("I"&(1+2))',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: '=INDIRECT("I"&(1+2))',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 7,
- c: 9,
- v: {
- v: 'I',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'I',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=INDIRECT("I"&(1+2))',
- },
- },
- {
- r: 7,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 8,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 8,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 8,
- c: 2,
- v: {
- v: 'Min Age:',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Min Age:',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 8,
- c: 3,
- v: {
- v: 17,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '17',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=MIN(D3:D6)',
- },
- },
- {
- r: 8,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 8,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 8,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 8,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 8,
- c: 8,
- v: {
- v: '=INDIRECT(I4&J3)',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: '=INDIRECT(I4&J3)',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 8,
- c: 9,
- v: {
- v: 1,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '1',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=INDIRECT(I4&J3)',
- },
- },
- {
- r: 8,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 9,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 9,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 9,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 9,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 9,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 9,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 9,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 9,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 9,
- c: 8,
- v: {
- v: '=INDIRECT("Formula!"&I2)',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: '=INDIRECT("Formula!"&I2)',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 9,
- c: 9,
- v: {
- ct: {
- fa: 'General',
- t: 'n',
- },
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- v: 1,
- m: '1',
- f: '=INDIRECT("Formula!"&I2)',
- },
- },
- {
- r: 9,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 10,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 10,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 10,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 10,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 10,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 10,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 10,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 10,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 10,
- c: 8,
- v: {
- v: '=INDIRECT("Formula!I2")',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: '=INDIRECT("Formula!I2")',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 10,
- c: 9,
- v: {
- ct: {
- fa: 'General',
- t: 'g',
- },
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- m: 'J2',
- v: 'J2',
- f: '=INDIRECT("Formula!I2")',
- },
- },
- {
- r: 10,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 11,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 11,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 11,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 11,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 11,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 11,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 11,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 11,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 11,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 11,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 11,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 12,
- c: 0,
- v: {
- v: 'Array Formula',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Array Formula',
- bg: null,
- bl: 1,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 12,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 12,
- c: 2,
- v: {
- v: 'Calculation',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Calculation',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- mc: {
- rs: 1,
- cs: 6,
- r: 12,
- c: 2,
- },
- },
- },
- {
- r: 12,
- c: 3,
- v: {
- mc: {
- r: 12,
- c: 2,
- },
- },
- },
- {
- r: 12,
- c: 4,
- v: {
- mc: {
- r: 12,
- c: 2,
- },
- },
- },
- {
- r: 12,
- c: 5,
- v: {
- mc: {
- r: 12,
- c: 2,
- },
- },
- },
- {
- r: 12,
- c: 6,
- v: {
- mc: {
- r: 12,
- c: 2,
- },
- },
- },
- {
- r: 12,
- c: 7,
- v: {
- mc: {
- r: 12,
- c: 2,
- },
- },
- },
- {
- r: 12,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 12,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 12,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 13,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 13,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 13,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 13,
- c: 3,
- v: {
- v: 'Match',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Match',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 13,
- c: 4,
- v: {
- v: 'Physical',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Physical',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 13,
- c: 5,
- v: {
- v: 'Chemistry',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Chemistry',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 13,
- c: 6,
- v: {
- v: 'Alex',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Alex',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 13,
- c: 7,
- v: {
- v: 'Sum',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Sum',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 13,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 13,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 13,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 14,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 14,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 14,
- c: 2,
- v: {
- v: 'Alice',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Alice',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 14,
- c: 3,
- v: {
- v: 97,
- ct: {
- fa: 'General',
- t: 'n',
- },
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- m: '97',
- },
- },
- {
- r: 14,
- c: 4,
- v: {
- v: 61,
- ct: {
- fa: 'General',
- t: 'n',
- },
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- m: '61',
- },
- },
- {
- r: 14,
- c: 5,
- v: {
- v: 53,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '53',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 14,
- c: 6,
- v: {
- v: 43,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '43',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 14,
- c: 7,
- v: {
- ct: {
- fa: 'General',
- t: 'n',
- },
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- v: 207,
- m: '207',
- f: '=SUBTOTAL(9,OFFSET($D$15,ROW($D$15:$D$18)-ROW($D$15),1,3))',
- },
- },
- {
- r: 14,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 14,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 14,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 15,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 15,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 15,
- c: 2,
- v: {
- v: 'John',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'John',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 15,
- c: 3,
- v: {
- v: 65,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '65',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 15,
- c: 4,
- v: {
- v: 76,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '76',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 15,
- c: 5,
- v: {
- v: 65,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '65',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 15,
- c: 6,
- v: {
- v: 55,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '55',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 15,
- c: 7,
- v: {
- ct: {
- fa: 'General',
- t: 'n',
- },
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- v: 182,
- m: '182',
- f: '=SUBTOTAL(9,OFFSET(E15,ROW(E15:E18)-ROW(E15),1,3))',
- },
- },
- {
- r: 15,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- ct: {
- fa: 'General',
- t: 'n',
- },
- },
- },
- {
- r: 15,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 15,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 16,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 16,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 16,
- c: 2,
- v: {
- v: 'Bob',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Bob',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 16,
- c: 3,
- v: {
- v: 55,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '55',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 16,
- c: 4,
- v: {
- v: 70,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '70',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 16,
- c: 5,
- v: {
- v: 64,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '64',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 16,
- c: 6,
- v: {
- v: 54,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '54',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 16,
- c: 7,
- v: {
- v: 152,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '152',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=SUBTOTAL(9,OFFSET(F15,ROW(F15:F18)-ROW(F15),1,3))',
- },
- },
- {
- r: 16,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 16,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 16,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 17,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 17,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 17,
- c: 2,
- v: {
- v: 'Jack',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Jack',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 17,
- c: 3,
- v: {
- v: 89,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '89',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 17,
- c: 4,
- v: {
- v: 77,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '77',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 17,
- c: 5,
- v: {
- v: 73,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '73',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 17,
- c: 6,
- v: {
- v: 73,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '73',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 17,
- c: 7,
- v: {
- v: 541,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '541',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=SUBTOTAL(9,OFFSET(G15,ROW(G15:G18)-ROW(G15),1,3))',
- },
- },
- {
- r: 17,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 17,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 17,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 18,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 18,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 18,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 18,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 18,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 18,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 18,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 18,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 18,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 18,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 18,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 19,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 19,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 19,
- c: 2,
- v: {
- v: 'Search',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Search',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- mc: {
- rs: 1,
- cs: 6,
- r: 19,
- c: 2,
- },
- },
- },
- {
- r: 19,
- c: 3,
- v: {
- mc: {
- r: 19,
- c: 2,
- },
- },
- },
- {
- r: 19,
- c: 4,
- v: {
- mc: {
- r: 19,
- c: 2,
- },
- },
- },
- {
- r: 19,
- c: 5,
- v: {
- mc: {
- r: 19,
- c: 2,
- },
- },
- },
- {
- r: 19,
- c: 6,
- v: {
- mc: {
- r: 19,
- c: 2,
- },
- },
- },
- {
- r: 19,
- c: 7,
- v: {
- mc: {
- r: 19,
- c: 2,
- },
- },
- },
- {
- r: 19,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 19,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 19,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 20,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 20,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 20,
- c: 2,
- v: {
- v: 'apple',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'apple',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 20,
- c: 3,
- v: {
- v: 'apple',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'apple',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 20,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 20,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 20,
- c: 6,
- v: {
- ct: {
- fa: 'General',
- t: 'g',
- },
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- mc: {
- rs: 1,
- cs: 5,
- r: 20,
- c: 6,
- },
- },
- },
- {
- r: 20,
- c: 7,
- v: {
- mc: {
- r: 20,
- c: 6,
- },
- },
- },
- {
- r: 20,
- c: 8,
- v: {
- mc: {
- r: 20,
- c: 6,
- },
- },
- },
- {
- r: 20,
- c: 9,
- v: {
- mc: {
- r: 20,
- c: 6,
- },
- },
- },
- {
- r: 20,
- c: 10,
- v: {
- mc: {
- r: 20,
- c: 6,
- },
- },
- },
- {
- r: 21,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 21,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 21,
- c: 2,
- v: {
- v: 'banana',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'banana',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 21,
- c: 3,
- v: {
- v: 'pear',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'pear',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 21,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 21,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 21,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 21,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 21,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 21,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 21,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 22,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 22,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 22,
- c: 2,
- v: {
- v: 'pear',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'pear',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 22,
- c: 3,
- v: {
- v: 'potato',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'potato',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 22,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 22,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 22,
- c: 6,
- v: {
- v: 'ArrayFormula Result:',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'ArrayFormula Result:',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- mc: {
- rs: 1,
- cs: 2,
- r: 22,
- c: 6,
- },
- },
- },
- {
- r: 22,
- c: 7,
- v: {
- mc: {
- r: 22,
- c: 6,
- },
- },
- },
- {
- r: 22,
- c: 8,
- v: {
- v: 'dumpling',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'dumpling',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=INDEX(D21:D25,MATCH("dumpling",D21:D25),1)',
- },
- },
- {
- r: 22,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- ct: {
- fa: 'General',
- t: 'b',
- },
- },
- },
- {
- r: 22,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- ct: {
- fa: 'General',
- t: 'n',
- },
- },
- },
- {
- r: 23,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 23,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 23,
- c: 2,
- v: {
- v: 'tomato',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'tomato',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 23,
- c: 3,
- v: {
- v: 'potato',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'potato',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 23,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 23,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 23,
- c: 6,
- v: {
- v: 'NomalFormula Result:',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'NomalFormula Result:',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- mc: {
- rs: 1,
- cs: 2,
- r: 23,
- c: 6,
- },
- },
- },
- {
- r: 23,
- c: 7,
- v: {
- mc: {
- r: 23,
- c: 6,
- },
- },
- },
- {
- r: 23,
- c: 8,
- v: {
- ct: {
- fa: 'General',
- t: 'b',
- },
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- m: 'FALSE',
- v: false,
- f: '=ISNA(MATCH(D21:D25,C21:C27,0))',
- },
- },
- {
- r: 23,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- ct: {
- fa: 'General',
- t: 'b',
- },
- },
- },
- {
- r: 23,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 24,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 24,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 24,
- c: 2,
- v: {
- v: 'potato',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'potato',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 24,
- c: 3,
- v: {
- v: 'dumpling',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'dumpling',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 24,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 24,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 24,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 24,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 24,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- ct: {
- fa: 'General',
- t: 'e',
- },
- },
- },
- {
- r: 24,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 24,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 25,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 25,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 25,
- c: 2,
- v: {
- v: 'cake',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'cake',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 25,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 25,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 25,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 25,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 25,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 25,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 25,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 25,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 26,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 26,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 26,
- c: 2,
- v: {
- v: 'noodel',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'noodel',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 26,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 26,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 26,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 26,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 26,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 26,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 26,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 26,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 27,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 27,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 27,
- c: 2,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 27,
- c: 3,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 27,
- c: 4,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 27,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 27,
- c: 6,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 27,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 27,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 27,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 27,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 28,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 28,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 28,
- c: 2,
- v: {
- v: 'Statistics',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Statistics',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- mc: {
- rs: 1,
- cs: 6,
- r: 28,
- c: 2,
- },
- },
- },
- {
- r: 28,
- c: 3,
- v: {
- mc: {
- r: 28,
- c: 2,
- },
- },
- },
- {
- r: 28,
- c: 4,
- v: {
- mc: {
- r: 28,
- c: 2,
- },
- },
- },
- {
- r: 28,
- c: 5,
- v: {
- mc: {
- r: 28,
- c: 2,
- },
- },
- },
- {
- r: 28,
- c: 6,
- v: {
- mc: {
- r: 28,
- c: 2,
- },
- },
- },
- {
- r: 28,
- c: 7,
- v: {
- mc: {
- r: 28,
- c: 2,
- },
- },
- },
- {
- r: 28,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 28,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 28,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 29,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 29,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 29,
- c: 2,
- v: {
- v: 'Product',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Product',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 29,
- c: 3,
- v: {
- v: 'Salesman',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Salesman',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 29,
- c: 4,
- v: {
- v: 'Units Sold',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Units Sold',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 29,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 29,
- c: 6,
- v: {
- v: 'Summing Sales: Faxes Sold By Brown',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Summing Sales: Faxes Sold By Brown',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- mc: {
- r: 29,
- c: 6,
- rs: 1,
- cs: 3,
- },
- },
- },
- {
- r: 29,
- c: 7,
- v: {
- mc: {
- r: 29,
- c: 6,
- },
- },
- },
- {
- r: 29,
- c: 8,
- v: {
- mc: {
- r: 29,
- c: 6,
- },
- },
- },
- {
- r: 29,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 29,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 30,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 30,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 30,
- c: 2,
- v: {
- v: 'Fax',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Fax',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 30,
- c: 3,
- v: {
- v: 'Brown',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Brown',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 30,
- c: 4,
- v: {
- v: 1,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '1',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 30,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 30,
- c: 6,
- v: {
- v: 61,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '61',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=SUM((C31:C39="Fax")*(D31:D39="Brown")*(E31:E39))',
- },
- },
- {
- r: 30,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 30,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 30,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 30,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 31,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 31,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 31,
- c: 2,
- v: {
- v: 'Phone',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Phone',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 31,
- c: 3,
- v: {
- v: 'Smith',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Smith',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 31,
- c: 4,
- v: {
- v: 10,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '10',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 31,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 31,
- c: 6,
- v: {
- v: 'Logical AND (Faxes And Brown)',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Logical AND (Faxes And Brown)',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- mc: {
- rs: 1,
- cs: 3,
- r: 31,
- c: 6,
- },
- },
- },
- {
- r: 31,
- c: 7,
- v: {
- mc: {
- r: 31,
- c: 6,
- },
- },
- },
- {
- r: 31,
- c: 8,
- v: {
- mc: {
- r: 31,
- c: 6,
- },
- },
- },
- {
- r: 31,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 31,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 32,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 32,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 32,
- c: 2,
- v: {
- v: 'Fax',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Fax',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 32,
- c: 3,
- v: {
- v: 'Jones',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Jones',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 32,
- c: 4,
- v: {
- v: 20,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '20',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 32,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 32,
- c: 6,
- v: {
- v: 2,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '2',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=SUM((C31:C39="Fax")*(D31:D39="Brown"))',
- },
- },
- {
- r: 32,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 32,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 32,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 32,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 33,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 33,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 33,
- c: 2,
- v: {
- v: 'Fax',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Fax',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 33,
- c: 3,
- v: {
- v: 'Smith',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Smith',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 33,
- c: 4,
- v: {
- v: 30,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '30',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 33,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 33,
- c: 6,
- v: {
- v: 'Logical OR (Faxes Or Jones)',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Logical OR (Faxes Or Jones)',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- mc: {
- rs: 1,
- cs: 3,
- r: 33,
- c: 6,
- },
- },
- },
- {
- r: 33,
- c: 7,
- v: {
- mc: {
- r: 33,
- c: 6,
- },
- },
- },
- {
- r: 33,
- c: 8,
- v: {
- mc: {
- r: 33,
- c: 6,
- },
- },
- },
- {
- r: 33,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 33,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 34,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 34,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 34,
- c: 2,
- v: {
- v: 'Phone',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Phone',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 34,
- c: 3,
- v: {
- v: 'Jones',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Jones',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 34,
- c: 4,
- v: {
- v: 40,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '40',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 34,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 34,
- c: 6,
- v: {
- v: 1,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '1',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=SUM(IF((C31:C39="Fax")+(D31:D39="Jones"),1,0))',
- },
- },
- {
- r: 34,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 34,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 34,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 34,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 35,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 35,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 35,
- c: 2,
- v: {
- v: 'PC',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'PC',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 35,
- c: 3,
- v: {
- v: 'Smith',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Smith',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 35,
- c: 4,
- v: {
- v: 50,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '50',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 35,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 35,
- c: 6,
- v: {
- v: 'Logical XOR (Fax Or Jones but not both)',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Logical XOR (Fax Or Jones but not both)',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- mc: {
- rs: 1,
- cs: 3,
- r: 35,
- c: 6,
- },
- },
- },
- {
- r: 35,
- c: 7,
- v: {
- mc: {
- r: 35,
- c: 6,
- },
- },
- },
- {
- r: 35,
- c: 8,
- v: {
- mc: {
- r: 35,
- c: 6,
- },
- },
- },
- {
- r: 35,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 35,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 36,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 36,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 36,
- c: 2,
- v: {
- v: 'Fax',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Fax',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 36,
- c: 3,
- v: {
- v: 'Brown',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Brown',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 36,
- c: 4,
- v: {
- v: 60,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '60',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 36,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 36,
- c: 6,
- v: {
- v: 1,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '1',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=SUM(IF(MOD((C31:C39="Fax")+(D31:D39="Jones"),2),1,0))',
- },
- },
- {
- r: 36,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 36,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 36,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 36,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 37,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 37,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 37,
- c: 2,
- v: {
- v: 'Phone',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Phone',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 37,
- c: 3,
- v: {
- v: 'Davis',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Davis',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 37,
- c: 4,
- v: {
- v: 70,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '70',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 37,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 37,
- c: 6,
- v: {
- v: 'Logical NAND (All Sales Except Fax And Jones)',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Logical NAND (All Sales Except Fax And Jones)',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- mc: {
- rs: 1,
- cs: 3,
- r: 37,
- c: 6,
- },
- },
- },
- {
- r: 37,
- c: 7,
- v: {
- mc: {
- r: 37,
- c: 6,
- },
- },
- },
- {
- r: 37,
- c: 8,
- v: {
- mc: {
- r: 37,
- c: 6,
- },
- },
- },
- {
- r: 37,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 37,
- c: 10,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 38,
- c: 0,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 38,
- c: 1,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 38,
- c: 2,
- v: {
- v: 'PC',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'PC',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 38,
- c: 3,
- v: {
- v: 'Jones',
- ct: {
- fa: 'General',
- t: 'g',
- },
- m: 'Jones',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 38,
- c: 4,
- v: {
- v: 80,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '80',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 38,
- c: 5,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 38,
- c: 6,
- v: {
- v: 1,
- ct: {
- fa: 'General',
- t: 'n',
- },
- m: '1',
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- f: '=SUM(IF((C31:C39="Fax")+(D31:D39="Jones")<>2,1,0))',
- },
- },
- {
- r: 38,
- c: 7,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 38,
- c: 8,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 38,
- c: 9,
- v: {
- bg: null,
- bl: 0,
- it: 0,
- ff: 9,
- fs: 10,
- fc: 'rgb(0, 0, 0)',
- ht: 1,
- vt: 0,
- },
- },
- {
- r: 38,
- c: 10,
- v: {},
- },
- ],
- calcChain: [
- {
- r: 6,
- c: 3,
- index: 1,
- // "func": [true, 23.75, "=AVERAGE(D3:D6)"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 7,
- c: 3,
- index: 1,
- // "func": [true, 30, "=MAX(D3:D6)"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 8,
- c: 3,
- index: 1,
- // "func": [true, 17, "=MIN(D3:D6)"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 5,
- c: 9,
- index: 1,
- // "func": [true, "J2", "=INDIRECT(\"I2\")"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 6,
- c: 9,
- index: 1,
- // "func": [true, 1, "=INDIRECT(I2)"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 7,
- c: 9,
- index: 1,
- // "func": [true, "I", "=INDIRECT(\"I\"&(1+2))"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 8,
- c: 9,
- index: 1,
- // "func": [true, 1, "=INDIRECT(I4&J3)"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 16,
- c: 7,
- index: 1,
- // "func": [true, 152, "=SUBTOTAL(9,OFFSET(F15,ROW(F15:F18)-ROW(F15),1,3))"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 17,
- c: 7,
- index: 1,
- // "func": [true, 541, "=SUBTOTAL(9,OFFSET(G15,ROW(G15:G18)-ROW(G15),1,3))"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 22,
- c: 8,
- index: 1,
- // "func": [true, "dumpling", "=INDEX(D21:D25,MATCH(\"dumpling\",D21:D25),1)"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 38,
- c: 6,
- index: 1,
- // "func": [true, 1, "=SUM(IF((C31:C39=\"Fax\")+(D31:D39=\"Jones\")<>2,1,0))"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 30,
- c: 6,
- index: 1,
- // "func": [true, "#NAME?", "=SUM((C31:C39=\"Fax\")*(D31:D39=\"Brown\")*(E31:E39))"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 32,
- c: 6,
- index: 1,
- // "func": [true, "#NAME?", "=SUM((C31:C39=\"Fax\")*(D31:D39=\"Brown\"))"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 34,
- c: 6,
- index: 1,
- // "func": [true, 1, "=SUM(IF((C31:C39=\"Fax\")+(D31:D39=\"Jones\"),1,0))"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 36,
- c: 6,
- index: 1,
- // "func": [true, 1, "=SUM(IF(MOD((C31:C39=\"Fax\")+(D31:D39=\"Jones\"),2),1,0))"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 9,
- c: 9,
- index: 1,
- // "func": [true, 1, "=INDIRECT(\"Formula!\"&I2)"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 10,
- c: 9,
- index: 1,
- // "func": [true, "J2", "=INDIRECT(\"Formula!I2\")"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 14,
- c: 7,
- index: 1,
- // "func": [true, 207, "=SUBTOTAL(9,OFFSET($D$15,ROW($D$15:$D$18)-ROW($D$15),1,3))"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 15,
- c: 7,
- index: 1,
- // "func": [true, 182, "=SUBTOTAL(9,OFFSET(E15,ROW(E15:E18)-ROW(E15),1,3))"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- {
- r: 23,
- c: 8,
- index: 1,
- // "func": [true, false, "=ISNA(MATCH(D21:D25,C21:C27,0))"],
- color: 'w',
- parent: null,
- chidren: {},
- times: 0,
- },
- ],
- ch_width: 1723,
- rh_height: 1010,
- universheet_select_save: [
- {
- left: 532,
- width: 123,
- top: 780,
- height: 19,
- left_move: 532,
- width_move: 123,
- top_move: 780,
- height_move: 19,
- row: [39, 39],
- column: [6, 6],
- row_focus: 39,
- column_focus: 6,
- },
- ],
- universheet_selection_range: [],
- scrollLeft: 0,
- scrollTop: 0,
- frozen: { type: 'row' },
-};
-
-// export default sheetFormula
diff --git a/packages/sheets-plugin-find/src/test/TextFind.test.ts b/packages/sheets-plugin-find/src/test/TextFind.test.ts
deleted file mode 100644
index 6d48c39de8..0000000000
--- a/packages/sheets-plugin-find/src/test/TextFind.test.ts
+++ /dev/null
@@ -1,173 +0,0 @@
-/* eslint-disable max-lines-per-function */
-/**
- * @jest-environment jsdom
- */
-import { SheetContext, Workbook, Worksheet } from '@univerjs/core';
-import { createCoreTestContainer } from '@univerjs/core/test/ContainerStartUp';
-import { TextFinder } from '../Domain';
-
-function demo() {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- sheetId: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: 1,
- v: 1,
- m: '1',
- },
- 1: {
- s: 1,
- v: 1,
- m: '1',
- },
- },
- 1: {
- 0: {
- s: 1,
- v: 1,
- m: 'AB',
- f: '=sum',
- },
- 1: {
- s: 1,
- v: 1,
- m: 'ab',
- },
- },
- 2: {
- 0: {
- s: 1,
- v: 1,
- m: 'test',
- },
- 1: {
- s: 1,
- v: 1,
- m: 'ab',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- return { worksheet, workbook };
-}
-
-test('Test findAll', () => {
- let { worksheet, workbook } = demo();
- const find = new TextFinder(worksheet, 'text', 'a');
- const a = find.findAll();
- expect(a).toEqual(null);
- const find1 = new TextFinder(worksheet, 'text', '1');
- const b = find1.findAll();
- expect(b?.length).toEqual(2);
-});
-
-test('Test findNext', () => {
- let { worksheet, workbook } = demo();
- const find = new TextFinder(worksheet, 'text', '1');
- const b = find.findNext();
- expect(b?.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 0,
- endColumn: 0,
- });
-});
-
-test('Test findPrevious', () => {
- let { worksheet, workbook } = demo();
- const find = new TextFinder(worksheet, 'text', '1');
- const b = find.findPrevious();
- expect(b?.getRangeData()).toEqual({
- startRow: 0,
- endRow: 0,
- startColumn: 1,
- endColumn: 1,
- });
-});
-
-test('Test matchCase', () => {
- let { worksheet, workbook } = demo();
- const find = new TextFinder(worksheet, 'text', 'ab');
- const b = find.matchCase(true).findNext();
- expect(b?.getRangeData()).toEqual({
- startRow: 1,
- endRow: 1,
- startColumn: 1,
- endColumn: 1,
- });
-});
-
-test('Test matchEntireCell', () => {
- let { worksheet, workbook } = demo();
- const find = new TextFinder(worksheet, 'text', 'a');
- const b = find.matchEntireCell(true).findNext();
- expect(b?.getRangeData()).toEqual(null);
-});
-
-test('Test matchFormulaText', () => {
- let { worksheet, workbook } = demo();
- const find = new TextFinder(worksheet, 'text', 'sum');
- const b = find.matchFormulaText(true).findNext();
- expect(b?.getRangeData()).toEqual({
- startRow: 1,
- endRow: 1,
- startColumn: 0,
- endColumn: 0,
- });
-});
-
-test('Test useRegularExpression', () => {
- let { worksheet, workbook } = demo();
- const find = new TextFinder(worksheet, 'text', '/test/');
- const b = find.useRegularExpression(true).findNext();
- expect(b?.getRangeData()).toEqual({
- startRow: 2,
- endRow: 2,
- startColumn: 0,
- endColumn: 0,
- });
-});
-
-test('Test replaceWith', () => {
- let { worksheet, workbook } = demo();
- const find = new TextFinder(worksheet, 'text', 'ab');
- const b = find.replaceWith('cc');
- expect(b).toEqual(1);
-});
-
-test('Test replaceWith', () => {
- let { worksheet, workbook } = demo();
- const find = new TextFinder(worksheet, 'text', 'ab');
- const b = find.replaceAllWith('cc');
- expect(b).toEqual(2);
-});
-
-test('Test getCurrentMatch', () => {
- let { worksheet, workbook } = demo();
- const find = new TextFinder(worksheet, 'text', 'ab');
- find.findNext();
- const b = find.getCurrentMatch();
- expect(b?.getRangeData()).toEqual({
- startRow: 1,
- endRow: 1,
- startColumn: 0,
- endColumn: 0,
- });
-});
diff --git a/packages/sheets-plugin-find/test/TextFind.test.ts b/packages/sheets-plugin-find/test/TextFind.test.ts
deleted file mode 100644
index f50d3f2f62..0000000000
--- a/packages/sheets-plugin-find/test/TextFind.test.ts
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { SheetContext, Workbook, Worksheet } from '@univerjs/core';
-import { createCoreTestContainer } from '@univerjs/core/test/ContainerStartUp';
-import { TextFinder } from '../src/Domain/TextFind';
-
-function demo() {
- const container = createCoreTestContainer({
- styles: {
- 1: {
- fs: 12,
- },
- },
- });
- const context = container.get<SheetContext>('Context');
- const workbook = container.get<Workbook>('WorkBook');
- const commandManager = workbook.getCommandManager();
-
- const configure = {
- sheetId: 'sheet',
- cellData: {
- 0: {
- 0: {
- s: 1,
- v: 1,
- m: 'a',
- },
- 1: {
- s: 1,
- v: 1,
- m: 'ab',
- },
- 2: {
- s: 1,
- v: 1,
- m: 'Abc',
- },
- },
- 1: {
- 0: {
- s: 1,
- v: 1,
- m: 'c',
- },
- 1: {
- s: 1,
- v: 1,
- m: 'cD',
- },
- 2: {
- s: 1,
- v: 1,
- m: 'cde',
- },
- },
- },
- status: 1,
- };
- const worksheet = container.createInstance(Worksheet, context, configure);
- workbook.insertSheet(worksheet);
- worksheet.setCommandManager(commandManager);
-
- return { worksheet, workbook };
-}
-
-test('Test findAll', () => {
- let { worksheet, workbook } = demo();
- const a = new TextFinder(worksheet, 'text', 'a');
- const range = a.findAll();
-});
-
-test('Test findNext', () => {
- let { worksheet, workbook } = demo();
- const a = new TextFinder(worksheet, 'text', 'a');
- const range = a.findNext();
-});
-
-test('Test findPrevious', () => {
- let { worksheet, workbook } = demo();
- const a = new TextFinder(worksheet, 'text', 'a');
- const range = a.findPrevious();
-});
-
-test('Test matchCase', () => {
- let { worksheet, workbook } = demo();
- const a = new TextFinder(worksheet, 'text', 'a');
- a.matchCase(true);
-});
-
-test('Test matchCase', () => {
- let { worksheet, workbook } = demo();
- const a = new TextFinder(worksheet, 'text', 'a');
- a.matchEntireCell(true);
-});
diff --git a/packages/sheets-plugin-formula/src/View/UI/FormulaLabel.tsx b/packages/sheets-plugin-formula/src/View/UI/FormulaLabel.tsx
index ae0bc6e089..00ec592a87 100644
--- a/packages/sheets-plugin-formula/src/View/UI/FormulaLabel.tsx
+++ b/packages/sheets-plugin-formula/src/View/UI/FormulaLabel.tsx
@@ -6,7 +6,6 @@ interface IProps {
}
export class FormulaLabel extends Component<IProps> {
- // private _render: BaseComponentRender;
render() {
// const SumIcon = this._render.renderFunction('SumIcon');
diff --git a/packages/sheets-plugin-image/src/Controller/OverGridImageController.ts b/packages/sheets-plugin-image/src/Controller/OverGridImageController.ts
index f2156ea96f..3a55ed243d 100644
--- a/packages/sheets-plugin-image/src/Controller/OverGridImageController.ts
+++ b/packages/sheets-plugin-image/src/Controller/OverGridImageController.ts
@@ -1,4 +1,4 @@
-import { BaseComponentRender, ComponentManager, Icon, IMenuService } from '@univerjs/base-ui';
+import { ComponentManager, Icon, IMenuService } from '@univerjs/base-ui';
import { Disposable, ICommandService } from '@univerjs/core';
import { SheetContainerUIController } from '@univerjs/ui-plugin-sheets';
import { Inject, Injector } from '@wendellhu/redi';
@@ -9,7 +9,6 @@ import { IImagePluginData } from '../Symbol';
import { ImportImageMenuItemFactory } from './menu';
export class OverGridImageController extends Disposable {
- protected _render: BaseComponentRender;
constructor(
@Inject(Injector) readonly _injector: Injector,
diff --git a/packages/sheets-plugin-import-xlsx/src/Controller/ImportXlsxController.ts b/packages/sheets-plugin-import-xlsx/src/Controller/ImportXlsxController.ts
index 373b6bf445..531dc63ffc 100644
--- a/packages/sheets-plugin-import-xlsx/src/Controller/ImportXlsxController.ts
+++ b/packages/sheets-plugin-import-xlsx/src/Controller/ImportXlsxController.ts
@@ -1,4 +1,4 @@
-import { BaseComponentRender, IMenuService } from '@univerjs/base-ui';
+import { IMenuService } from '@univerjs/base-ui';
import { Disposable, ICommandService } from '@univerjs/core';
import { IToolbarItemProps, SheetContainerUIController } from '@univerjs/ui-plugin-sheets';
import { Inject, Injector } from '@wendellhu/redi';
@@ -9,8 +9,6 @@ import { ImportMenuItemFactory } from './menu';
export class ImportXlsxController extends Disposable {
protected _toolButton: IToolbarItemProps;
- protected _render: BaseComponentRender;
-
constructor(
@Inject(SheetContainerUIController) private readonly _sheetContainerUIController: SheetContainerUIController,
@Inject(Injector) private readonly _injector: Injector,
diff --git a/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts b/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts
index 676d9db8ae..4b322628a5 100644
--- a/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts
+++ b/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts
@@ -1,4 +1,4 @@
-import { BaseComponentRender, ComponentManager, IMenuService } from '@univerjs/base-ui';
+import { ComponentManager, IMenuService } from '@univerjs/base-ui';
import { Disposable, ICommandService, ICurrentUniverService, IRangeData, ObjectMatrix, ObjectMatrixPrimitiveType, Range } from '@univerjs/core';
import { Inject, Injector } from '@wendellhu/redi';
@@ -79,7 +79,6 @@ import { NumfmtModalController } from './NumfmtModalController';
}));
*/
export class NumfmtController extends Disposable {
- protected _render: BaseComponentRender;
constructor(
@Inject(ComponentManager) private readonly _componentManager: ComponentManager,
diff --git a/packages/sheets-plugin-numfmt/src/View/UI/FormatContent.tsx b/packages/sheets-plugin-numfmt/src/View/UI/FormatContent.tsx
index 58fdb91d7b..6e28d73f31 100644
--- a/packages/sheets-plugin-numfmt/src/View/UI/FormatContent.tsx
+++ b/packages/sheets-plugin-numfmt/src/View/UI/FormatContent.tsx
@@ -1,5 +1,5 @@
-import { BaseComponentRender, BaseComponentSheet } from '@univerjs/base-ui';
import { Component, createRef } from 'react';
+
import styles from './index.module.less';
interface IProps {
@@ -12,8 +12,6 @@ interface IProps {
interface IState {}
export class FormatContent extends Component<IProps, IState> {
- private _render: BaseComponentRender;
-
private _ref = createRef();
constructor(props: IProps) {
@@ -21,10 +19,7 @@ export class FormatContent extends Component<IProps, IState> {
this.initialize(props);
}
- initialize(props: IProps) {
- const component = this.getContext().getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;
- this._render = component.getComponentRender();
- }
+ initialize(props: IProps) {}
getInput() {
const { input } = this.props;
diff --git a/packages/sheets-plugin-numfmt/src/View/UI/NumfmtModal.tsx b/packages/sheets-plugin-numfmt/src/View/UI/NumfmtModal.tsx
index 86339541ef..198bcf578a 100644
--- a/packages/sheets-plugin-numfmt/src/View/UI/NumfmtModal.tsx
+++ b/packages/sheets-plugin-numfmt/src/View/UI/NumfmtModal.tsx
@@ -1,4 +1,4 @@
-import { BaseComponentProps, BaseComponentRender, BaseComponentSheet } from '@univerjs/base-ui';
+import { BaseComponentProps} from '@univerjs/base-ui';
import { Component } from 'react';
import { SheetPlugin } from '@univerjs/base-sheets';
import { PLUGIN_NAMES } from '@univerjs/core';
@@ -13,7 +13,6 @@ interface IState {
}
export class NumfmtModal extends Component<IProps, IState> {
- private _render: BaseComponentRender;
constructor(props: IProps) {
super(props);
@@ -21,8 +20,6 @@ export class NumfmtModal extends Component<IProps, IState> {
}
initialize(props: IProps): void {
- const component = this.getContext().getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;
- this._render = component.getComponentRender();
this.state = {
modalData: [],
diff --git a/packages/sheets-plugin-operation/src/UI/ClipboardInput.tsx b/packages/sheets-plugin-operation/src/UI/ClipboardInput.tsx
index 68a58d0993..e63b3a06ea 100644
--- a/packages/sheets-plugin-operation/src/UI/ClipboardInput.tsx
+++ b/packages/sheets-plugin-operation/src/UI/ClipboardInput.tsx
@@ -1,4 +1,4 @@
-import { BaseComponentRender, Input } from '@univerjs/base-ui';
+import { Input } from '@univerjs/base-ui';
import { Component } from 'react';
interface IProps {
@@ -9,7 +9,6 @@ interface IProps {
}
export class ClipboardInput extends Component<IProps> {
- private _render: BaseComponentRender;
render() {
const { prefix, placeholder1, suffix, placeholder2 } = this.props;
diff --git a/packages/ui-plugin-sheets/src/View/FormulaBar/FormulaBar.tsx b/packages/ui-plugin-sheets/src/View/FormulaBar/FormulaBar.tsx
index 5b3d8592f1..7df5663a8a 100644
--- a/packages/ui-plugin-sheets/src/View/FormulaBar/FormulaBar.tsx
+++ b/packages/ui-plugin-sheets/src/View/FormulaBar/FormulaBar.tsx
@@ -1,4 +1,4 @@
-import { AppContext, BaseComponentProps, BaseComponentRender, BaseSelectChildrenProps, debounce, Icon } from '@univerjs/base-ui';
+import { AppContext, BaseComponentProps, BaseSelectChildrenProps, debounce, Icon } from '@univerjs/base-ui';
import { Nullable } from '@univerjs/core';
import { Component } from 'react';
@@ -21,8 +21,6 @@ export interface BaseFormulaBarProps extends BaseComponentProps {}
export class FormulaBar extends Component<BaseFormulaBarProps, FormulaState> {
static override contextType = AppContext;
- private _render: BaseComponentRender;
-
// formulaContent = createRef<HTMLDivElement>();
constructor(props: BaseFormulaBarProps) {