@univerjs/engine-formula 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +3738 -3211
- package/lib/types/basics/date.d.ts +9 -15
- package/lib/types/engine/reference-object/base-reference-object.d.ts +1 -0
- package/lib/types/engine/value-object/primitive-object.d.ts +1 -1
- package/lib/types/functions/date/function-map.d.ts +3 -1
- package/lib/types/functions/date/hour/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/hour/index.d.ts +9 -0
- package/lib/types/functions/date/minute/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/minute/index.d.ts +9 -0
- package/lib/types/functions/date/networkdays/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/networkdays/index.d.ts +8 -0
- package/lib/types/functions/date/networkdays-intl/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/networkdays-intl/index.d.ts +9 -0
- package/lib/types/functions/date/second/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/second/index.d.ts +9 -0
- package/lib/types/functions/date/weekday/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/weekday/index.d.ts +9 -0
- package/lib/types/functions/date/workday/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/workday/index.d.ts +8 -0
- package/lib/types/functions/date/workday-intl/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/date/workday-intl/index.d.ts +9 -0
- package/lib/types/functions/math/sumproduct/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/math/sumproduct/index.d.ts +8 -0
- package/lib/umd/index.js +1 -1
- package/package.json +10 -10
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
import { BaseValueObject, ErrorValueObject } from '../engine/value-object/base-value-object';
|
|
2
|
+
|
|
16
3
|
export declare const DEFAULT_DATE_FORMAT = "yyyy/mm/dd;@";
|
|
17
4
|
export declare const DEFAULT_NOW_FORMAT = "yyyy/mm/dd hh:mm";
|
|
18
5
|
export declare const DEFAULT_TIME_FORMAT = "h:mm A/P";
|
|
@@ -35,6 +22,7 @@ export declare function excelDateSerial(date: Date): number;
|
|
|
35
22
|
*/
|
|
36
23
|
export declare function excelDateTimeSerial(date: Date): number;
|
|
37
24
|
export declare function excelSerialToDate(serial: number): Date;
|
|
25
|
+
export declare function excelSerialToDateTime(serial: number): Date;
|
|
38
26
|
export declare function formatDateDefault(date: Date): string;
|
|
39
27
|
/**
|
|
40
28
|
* Validate date string
|
|
@@ -48,3 +36,9 @@ export declare function parseFormattedDate(value: string): any;
|
|
|
48
36
|
export declare function parseFormattedValue(value: string): any;
|
|
49
37
|
export declare function parseFormattedTime(value: string): any;
|
|
50
38
|
export declare function isDate(format: string): any;
|
|
39
|
+
export declare function isValidWeekend(weekend: number | string): boolean;
|
|
40
|
+
export declare function getWeekendArray(weekend: number | string): number[];
|
|
41
|
+
export declare function countWorkingDays(startDateSerialNumber: number, endDateSerialNumber: number, weekend?: number | string, holidays?: number[]): number;
|
|
42
|
+
export declare function getDateSerialNumberByWorkingDays(startDateSerialNumber: number, workingDays: number, weekend?: number | string, holidays?: number[]): (number | ErrorValueObject);
|
|
43
|
+
export declare function getDateSerialNumberByObject(serialNumberObject: BaseValueObject): (ErrorValueObject | number);
|
|
44
|
+
export declare function getWeekDayByDateSerialNumber(dateSerialNumber: number): number;
|
|
@@ -89,6 +89,7 @@ export declare class BaseReferenceObject extends ObjectClassType {
|
|
|
89
89
|
unionBy(referenceObject: BaseReferenceObject): NodeValueType;
|
|
90
90
|
unionRange(rangeData1: IRange, rangeData2: IRange): IRange;
|
|
91
91
|
getCellValueObject(cell: ICellData): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | StringValueObject | ArrayValueObject;
|
|
92
|
+
private _getPatternByCell;
|
|
92
93
|
getCellByRow(row: number): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | StringValueObject | ArrayValueObject;
|
|
93
94
|
getCellByColumn(column: number): ErrorValueObject | NullValueObject | NumberValueObject | import('../value-object/primitive-object').BooleanValueObject | StringValueObject | ArrayValueObject;
|
|
94
95
|
getCurrentActiveSheetData(): import('../../basics/common').ISheetItem;
|
|
@@ -165,4 +165,4 @@ export declare class StringValueObject extends BaseValueObject {
|
|
|
165
165
|
}
|
|
166
166
|
export declare function createBooleanValueObjectByRawValue(rawValue: string | number | boolean): BooleanValueObject;
|
|
167
167
|
export declare function createStringValueObjectByRawValue(rawValue: string | number | boolean): StringValueObject;
|
|
168
|
-
export declare function createNumberValueObjectByRawValue(rawValue: string | number | boolean): ErrorValueObject | NumberValueObject;
|
|
168
|
+
export declare function createNumberValueObjectByRawValue(rawValue: string | number | boolean, pattern?: string): ErrorValueObject | NumberValueObject;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { DateFunction } from './date';
|
|
2
2
|
import { FUNCTION_NAMES_DATE } from './function-names';
|
|
3
|
+
import { NetworkdaysIntl } from './networkdays-intl';
|
|
4
|
+
import { WorkdayIntl } from './workday-intl';
|
|
3
5
|
|
|
4
|
-
export declare const functionDate: (FUNCTION_NAMES_DATE | typeof DateFunction)[][];
|
|
6
|
+
export declare const functionDate: ((FUNCTION_NAMES_DATE | typeof DateFunction)[] | (FUNCTION_NAMES_DATE | typeof NetworkdaysIntl)[] | (FUNCTION_NAMES_DATE | typeof WorkdayIntl)[])[];
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
2
|
+
import { BaseFunction } from '../../base-function';
|
|
3
|
+
|
|
4
|
+
export declare class Hour extends BaseFunction {
|
|
5
|
+
minParams: number;
|
|
6
|
+
maxParams: number;
|
|
7
|
+
calculate(serialNumber: BaseValueObject): BaseValueObject;
|
|
8
|
+
private _handleSingleObject;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
2
|
+
import { BaseFunction } from '../../base-function';
|
|
3
|
+
|
|
4
|
+
export declare class Minute extends BaseFunction {
|
|
5
|
+
minParams: number;
|
|
6
|
+
maxParams: number;
|
|
7
|
+
calculate(serialNumber: BaseValueObject): BaseValueObject;
|
|
8
|
+
private _handleSingleObject;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
2
|
+
import { BaseFunction } from '../../base-function';
|
|
3
|
+
|
|
4
|
+
export declare class Networkdays extends BaseFunction {
|
|
5
|
+
minParams: number;
|
|
6
|
+
maxParams: number;
|
|
7
|
+
calculate(startDate: BaseValueObject, endDate: BaseValueObject, holidays?: BaseValueObject): BaseValueObject;
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
2
|
+
import { BaseFunction } from '../../base-function';
|
|
3
|
+
|
|
4
|
+
export declare class NetworkdaysIntl extends BaseFunction {
|
|
5
|
+
minParams: number;
|
|
6
|
+
maxParams: number;
|
|
7
|
+
calculate(startDate: BaseValueObject, endDate: BaseValueObject, weekend?: BaseValueObject, holidays?: BaseValueObject): BaseValueObject;
|
|
8
|
+
private _handleSingleObject;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
2
|
+
import { BaseFunction } from '../../base-function';
|
|
3
|
+
|
|
4
|
+
export declare class Second extends BaseFunction {
|
|
5
|
+
minParams: number;
|
|
6
|
+
maxParams: number;
|
|
7
|
+
calculate(serialNumber: BaseValueObject): BaseValueObject;
|
|
8
|
+
private _handleSingleObject;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
2
|
+
import { BaseFunction } from '../../base-function';
|
|
3
|
+
|
|
4
|
+
export declare class Weekday extends BaseFunction {
|
|
5
|
+
minParams: number;
|
|
6
|
+
maxParams: number;
|
|
7
|
+
calculate(serialNumber: BaseValueObject, returnType?: BaseValueObject): BaseValueObject;
|
|
8
|
+
private _handleSingleObject;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
2
|
+
import { BaseFunction } from '../../base-function';
|
|
3
|
+
|
|
4
|
+
export declare class Workday extends BaseFunction {
|
|
5
|
+
minParams: number;
|
|
6
|
+
maxParams: number;
|
|
7
|
+
calculate(startDate: BaseValueObject, days: BaseValueObject, holidays?: BaseValueObject): BaseValueObject;
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
2
|
+
import { BaseFunction } from '../../base-function';
|
|
3
|
+
|
|
4
|
+
export declare class WorkdayIntl extends BaseFunction {
|
|
5
|
+
minParams: number;
|
|
6
|
+
maxParams: number;
|
|
7
|
+
calculate(startDate: BaseValueObject, days: BaseValueObject, weekend?: BaseValueObject, holidays?: BaseValueObject): BaseValueObject;
|
|
8
|
+
private _handleSingleObject;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
2
|
+
import { BaseFunction } from '../../base-function';
|
|
3
|
+
|
|
4
|
+
export declare class Sumproduct extends BaseFunction {
|
|
5
|
+
minParams: number;
|
|
6
|
+
maxParams: number;
|
|
7
|
+
calculate(array1: BaseValueObject, ...variants: BaseValueObject[]): BaseValueObject;
|
|
8
|
+
}
|