@univerjs/sheets-data-validation 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/README.md +29 -0
- package/lib/cjs/index.js +9 -0
- package/lib/es/index.js +6749 -0
- package/lib/index.css +1 -0
- package/lib/types/commands/commands/data-validation.command.d.ts +21 -0
- package/lib/types/commands/mutations/formula.mutation.d.ts +10 -0
- package/lib/types/commands/operations/data-validation.operation.d.ts +18 -0
- package/lib/types/common/const.d.ts +18 -0
- package/lib/types/common/date-text-map.d.ts +6 -0
- package/lib/types/controllers/dv-alert.controller.d.ts +14 -0
- package/lib/types/controllers/dv-auto-fill.controller.d.ts +10 -0
- package/lib/types/controllers/dv-copy-paste.controller.d.ts +13 -0
- package/lib/types/controllers/dv-ref-range.controller.d.ts +29 -0
- package/lib/types/controllers/dv-reject-input.controller.d.ts +14 -0
- package/lib/types/controllers/dv-render.controller.d.ts +29 -0
- package/lib/types/controllers/dv-resource.controller.d.ts +14 -0
- package/lib/types/controllers/dv-sheet.controller.d.ts +13 -0
- package/lib/types/controllers/dv.controller.d.ts +22 -0
- package/lib/types/controllers/dv.menu.d.ts +7 -0
- package/lib/types/index.d.ts +37 -0
- package/lib/types/locale/en-US.d.ts +4 -0
- package/lib/types/locale/index.d.ts +17 -0
- package/lib/types/locale/zh-CN.d.ts +160 -0
- package/lib/types/models/rule-matrix.d.ts +28 -0
- package/lib/types/models/sheet-data-validation-manager.d.ts +28 -0
- package/lib/types/plugin.d.ts +10 -0
- package/lib/types/services/data-validation-panel.service.d.ts +27 -0
- package/lib/types/services/dropdown-manager.service.d.ts +37 -0
- package/lib/types/services/dv-cache.service.d.ts +21 -0
- package/lib/types/services/dv-custom-formula.service.d.ts +41 -0
- package/lib/types/services/dv-formula.service.d.ts +21 -0
- package/lib/types/services/dv.service.d.ts +20 -0
- package/lib/types/services/dv.tips.d.ts +17 -0
- package/lib/types/services/formula-common.d.ts +19 -0
- package/lib/types/services/register-formula.service.d.ts +28 -0
- package/lib/types/types/const/index.d.ts +17 -0
- package/lib/types/types/const/operator-text-map.d.ts +5 -0
- package/lib/types/types/const/two-formula-operators.d.ts +3 -0
- package/lib/types/types/index.d.ts +17 -0
- package/lib/types/types/interface/i-update-rule-formula.d.ts +19 -0
- package/lib/types/types/interface/index.d.ts +16 -0
- package/lib/types/utils/date.d.ts +17 -0
- package/lib/types/utils/formula.d.ts +3 -0
- package/lib/types/utils/get-cell-data-origin.d.ts +3 -0
- package/lib/types/validators/checkbox-validator.d.ts +25 -0
- package/lib/types/validators/custom-validator.d.ts +15 -0
- package/lib/types/validators/date-validator.d.ts +31 -0
- package/lib/types/validators/decimal-validator.d.ts +36 -0
- package/lib/types/validators/index.d.ts +20 -0
- package/lib/types/validators/list-multiple-validator.d.ts +27 -0
- package/lib/types/validators/list-validator.d.ts +28 -0
- package/lib/types/validators/text-length-validator.d.ts +32 -0
- package/lib/types/validators/util.d.ts +6 -0
- package/lib/types/validators/whole-validator.d.ts +35 -0
- package/lib/types/views/date-dropdown/index.d.ts +4 -0
- package/lib/types/views/detail/index.d.ts +3 -0
- package/lib/types/views/drop-down/CellDropdown.d.ts +3 -0
- package/lib/types/views/drop-down/index.d.ts +18 -0
- package/lib/types/views/formula-input/base-formula-input.d.ts +4 -0
- package/lib/types/views/formula-input/checkbox-formula-input.d.ts +4 -0
- package/lib/types/views/formula-input/custom-formula-input.d.ts +4 -0
- package/lib/types/views/formula-input/formula-input.d.ts +5 -0
- package/lib/types/views/formula-input/index.d.ts +7 -0
- package/lib/types/views/formula-input/list-formula-input.d.ts +4 -0
- package/lib/types/views/index.d.ts +20 -0
- package/lib/types/views/item/index.d.ts +10 -0
- package/lib/types/views/list/index.d.ts +3 -0
- package/lib/types/views/list-dropdown/index.d.ts +4 -0
- package/lib/types/views/options/index.d.ts +9 -0
- package/lib/types/views/panel/index.d.ts +3 -0
- package/lib/types/views/render-mode/index.d.ts +11 -0
- package/lib/types/widgets/checkbox-widget.d.ts +20 -0
- package/lib/types/widgets/dropdown-multiple-widget.d.ts +20 -0
- package/lib/types/widgets/dropdown-widget.d.ts +32 -0
- package/lib/types/widgets/shape/dropdown.d.ts +13 -0
- package/lib/types/widgets/shape/index.d.ts +18 -0
- package/lib/types/widgets/shape/layout.d.ts +38 -0
- package/lib/umd/index.js +9 -0
- package/package.json +79 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { DataValidationPanel } from './panel';
|
|
17
|
+
export { ListDropDown } from './list-dropdown';
|
|
18
|
+
export { DateDropdown } from './date-dropdown';
|
|
19
|
+
export declare const LIST_DROPDOWN_KEY = "data-validation.list.dropdown";
|
|
20
|
+
export declare const DATE_DROPDOWN_KEY = "data-validation.date.dropdown";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ISheetDataValidationRule } from '@univerjs/core';
|
|
3
|
+
|
|
4
|
+
export interface IDataValidationDetailProps {
|
|
5
|
+
rule: ISheetDataValidationRule;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
unitId: string;
|
|
8
|
+
subUnitId: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const DataValidationItem: (props: IDataValidationDetailProps) => React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IDataValidationRuleOptions } from '@univerjs/core';
|
|
3
|
+
|
|
4
|
+
export interface IDataValidationOptionsParams {
|
|
5
|
+
value: IDataValidationRuleOptions;
|
|
6
|
+
onChange: (value: IDataValidationRuleOptions) => void;
|
|
7
|
+
extraComponent?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function DataValidationOptions(props: IDataValidationOptionsParams): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IDataValidationRuleOptions } from '@univerjs/core';
|
|
3
|
+
|
|
4
|
+
export interface IListRenderModeInputProps {
|
|
5
|
+
value: IDataValidationRuleOptions;
|
|
6
|
+
onChange: (value: IDataValidationRuleOptions) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ListRenderModeInput(props: IListRenderModeInputProps): React.JSX.Element;
|
|
9
|
+
export declare namespace ListRenderModeInput {
|
|
10
|
+
var componentKey: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DataValidationFormulaService } from '../services/dv-formula.service';
|
|
2
|
+
import { IBaseDataValidationWidget } from '@univerjs/data-validation';
|
|
3
|
+
import { ICommandService, ThemeService, ICellRenderContext } from '@univerjs/core';
|
|
4
|
+
import { IMouseEvent, IPointerEvent, UniverRenderingContext2D } from '@univerjs/engine-render';
|
|
5
|
+
|
|
6
|
+
export declare class CheckboxRender implements IBaseDataValidationWidget {
|
|
7
|
+
private readonly _commandService;
|
|
8
|
+
private readonly _formulaService;
|
|
9
|
+
private readonly _themeService;
|
|
10
|
+
private _calc;
|
|
11
|
+
constructor(_commandService: ICommandService, _formulaService: DataValidationFormulaService, _themeService: ThemeService);
|
|
12
|
+
calcCellAutoHeight(): number | undefined;
|
|
13
|
+
private _parseFormula;
|
|
14
|
+
drawWith(ctx: UniverRenderingContext2D, info: ICellRenderContext): void;
|
|
15
|
+
isHit(evt: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}, info: ICellRenderContext): boolean;
|
|
19
|
+
onPointerDown(info: ICellRenderContext, evt: IPointerEvent | IMouseEvent): Promise<void>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IBaseDataValidationWidget } from '@univerjs/data-validation';
|
|
2
|
+
import { IMouseEvent, IPointerEvent, Spreadsheet, SpreadsheetSkeleton, UniverRenderingContext2D } from '@univerjs/engine-render';
|
|
3
|
+
import { ICommandService, ICellRenderContext } from '@univerjs/core';
|
|
4
|
+
|
|
5
|
+
export declare class DropdownMultipleWidget implements IBaseDataValidationWidget {
|
|
6
|
+
private readonly _commandService;
|
|
7
|
+
zIndex?: number | undefined;
|
|
8
|
+
private _dropdownInfoMap;
|
|
9
|
+
constructor(_commandService: ICommandService);
|
|
10
|
+
private _ensureMap;
|
|
11
|
+
private _generateKey;
|
|
12
|
+
private _drawDownIcon;
|
|
13
|
+
drawWith(ctx: UniverRenderingContext2D, info: ICellRenderContext, skeleton: SpreadsheetSkeleton, spreadsheets: Spreadsheet): void;
|
|
14
|
+
calcCellAutoHeight(info: ICellRenderContext): number | undefined;
|
|
15
|
+
isHit(position: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}, info: ICellRenderContext): boolean;
|
|
19
|
+
onPointerDown(info: ICellRenderContext, evt: IPointerEvent | IMouseEvent): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DataValidationModel, DataValidatorRegistryService, IBaseDataValidationWidget } from '@univerjs/data-validation';
|
|
2
|
+
import { IMouseEvent, IPointerEvent, Spreadsheet, SpreadsheetSkeleton, UniverRenderingContext2D } from '@univerjs/engine-render';
|
|
3
|
+
import { ICommandService, LocaleService, ICellRenderContext, IPaddingData } from '@univerjs/core';
|
|
4
|
+
|
|
5
|
+
export interface IDropdownInfo {
|
|
6
|
+
top: number;
|
|
7
|
+
left: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class DropdownWidget implements IBaseDataValidationWidget {
|
|
12
|
+
private readonly _localeService;
|
|
13
|
+
private readonly _commandService;
|
|
14
|
+
private readonly _dataValidationModel;
|
|
15
|
+
private readonly _dataValidatorRegistryService;
|
|
16
|
+
static padding: IPaddingData;
|
|
17
|
+
private _dropdownInfoMap;
|
|
18
|
+
constructor(_localeService: LocaleService, _commandService: ICommandService, _dataValidationModel: DataValidationModel, _dataValidatorRegistryService: DataValidatorRegistryService);
|
|
19
|
+
zIndex?: number | undefined;
|
|
20
|
+
onPointerEnter?: ((info: ICellRenderContext) => void) | undefined;
|
|
21
|
+
onPointerLeave?: ((info: ICellRenderContext) => void) | undefined;
|
|
22
|
+
private _ensureMap;
|
|
23
|
+
private _generateKey;
|
|
24
|
+
private _drawDownIcon;
|
|
25
|
+
drawWith(ctx: UniverRenderingContext2D, info: ICellRenderContext, skeleton: SpreadsheetSkeleton, spreadsheets: Spreadsheet): void;
|
|
26
|
+
calcCellAutoHeight(info: ICellRenderContext): number | undefined;
|
|
27
|
+
isHit(position: {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
}, info: ICellRenderContext): boolean;
|
|
31
|
+
onPointerDown(info: ICellRenderContext, evt: IPointerEvent | IMouseEvent): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IDropdownLayoutInfo } from './layout';
|
|
2
|
+
import { IShapeProps, UniverRenderingContext, Shape } from '@univerjs/engine-render';
|
|
3
|
+
|
|
4
|
+
export interface IDropdownProps extends IShapeProps {
|
|
5
|
+
fontString: string;
|
|
6
|
+
fontFamily: string;
|
|
7
|
+
fontSize: number;
|
|
8
|
+
info: IDropdownLayoutInfo;
|
|
9
|
+
color: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class Dropdown extends Shape<IDropdownProps> {
|
|
12
|
+
static drawWith(ctx: UniverRenderingContext, props: IDropdownProps): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { Dropdown } from './dropdown';
|
|
17
|
+
export type { IDropdownProps } from './dropdown';
|
|
18
|
+
export * from './layout';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IDocumentSkeletonFontStyle } from '@univerjs/engine-render';
|
|
2
|
+
import { IStyleData, Nullable } from '@univerjs/core';
|
|
3
|
+
|
|
4
|
+
export declare const PADDING_H = 4;
|
|
5
|
+
export declare const PADDING_V = 0;
|
|
6
|
+
export declare const MARGIN_H = 4;
|
|
7
|
+
export declare const MARGIN_V = 4;
|
|
8
|
+
export declare const CELL_PADDING_H = 6;
|
|
9
|
+
export declare const CELL_PADDING_V = 6;
|
|
10
|
+
export declare const ICON_PLACE = 14;
|
|
11
|
+
export declare function measureDropdownItemText(text: string, style: Nullable<IStyleData>): import('@univerjs/engine-render').IDocumentSkeletonBoundingBox;
|
|
12
|
+
export declare function getDropdownItemSize(text: string, fontStyle: IDocumentSkeletonFontStyle): {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
ba: number;
|
|
16
|
+
};
|
|
17
|
+
export interface IDropdownLayoutInfo {
|
|
18
|
+
layout: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
ba: number;
|
|
22
|
+
};
|
|
23
|
+
text: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IDropdownLine {
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
items: (IDropdownLayoutInfo & {
|
|
29
|
+
left: number;
|
|
30
|
+
})[];
|
|
31
|
+
}
|
|
32
|
+
export declare function layoutDropdowns(items: string[], fontStyle: IDocumentSkeletonFontStyle, cellWidth: number, cellHeight: number): {
|
|
33
|
+
lines: IDropdownLine[];
|
|
34
|
+
totalHeight: number;
|
|
35
|
+
contentWidth: number;
|
|
36
|
+
contentHeight: number;
|
|
37
|
+
cellAutoHeight: number;
|
|
38
|
+
};
|