Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(formula): supplement ARRAY_CONSTRAIN/FLATTEN formula (#3922)
wpxp12345620c81f305e8c
diff --git a/packages/engine-formula/src/functions/array/array-constrain/__tests__/index.spec.ts b/packages/engine-formula/src/functions/array/array-constrain/__tests__/index.spec.tsnew file mode 100644index 0000000000..197fd6b437--- /dev/null+++ b/packages/engine-formula/src/functions/array/array-constrain/__tests__/index.spec.ts@@ -0,0 +1,122 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { describe, expect, it } from 'vitest';++import { ErrorType } from '../../../../basics/error-type';+import { ArrayValueObject, transformToValueObject } from '../../../../engine/value-object/array-value-object';+import { ErrorValueObject } from '../../../../engine/value-object/base-value-object';+import { BooleanValueObject, NullValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';+import { getObjectValue } from '../../../__tests__/create-function-test-bed';+import { FUNCTION_NAMES_ARRAY } from '../../function-names';+import { ArrayConstrain } from '../index';++describe('Test arrayConstrain function', () => {+ const testFunction = new ArrayConstrain(FUNCTION_NAMES_ARRAY.ARRAY_CONSTRAIN);++ describe('ArrayConstrain', () => {+ it('Value is normal', () => {+ const inputRange = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [1, 2, 3],+ [4, 5, 6],+ [7, 8, 9],+ ]),+ rowCount: 3,+ columnCount: 3,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const numRows = NumberValueObject.create(2);+ const numCols = NumberValueObject.create(2);+ const result = testFunction.calculate(inputRange, numRows, numCols);+ expect(getObjectValue(result)).toStrictEqual([+ [1, 2],+ [4, 5],+ ]);+ });++ it('InputRange value test', () => {+ const inputRange = ErrorValueObject.create(ErrorType.NAME);+ const numRows = NumberValueObject.create(2);+ const numCols = NumberValueObject.create(2);+ const result = testFunction.calculate(inputRange, numRows, numCols);+ expect(getObjectValue(result)).toBe(ErrorType.NAME);++ const inputRange2 = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [1],+ ]),+ rowCount: 1,+ columnCount: 1,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const result2 = testFunction.calculate(inputRange2, numRows, numCols);+ expect(getObjectValue(result2)).toBe(1);+ });++ it('NumRows and numCols value test', () => {+ const inputRange = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [1, 2, 3],+ [4, 5, 6],+ [7, 8, 9],+ ]),+ rowCount: 3,+ columnCount: 3,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const numRows = NullValueObject.create();+ const numCols = NumberValueObject.create(2);+ const result = testFunction.calculate(inputRange, numRows, numCols);+ expect(getObjectValue(result)).toBe(ErrorType.REF);++ const numRows2 = NumberValueObject.create(-2);+ const result2 = testFunction.calculate(inputRange, numRows2, numCols);+ expect(getObjectValue(result2)).toBe(ErrorType.NUM);++ const numRows3 = BooleanValueObject.create(true);+ const result3 = testFunction.calculate(inputRange, numRows3, numCols);+ expect(getObjectValue(result3)).toStrictEqual([+ [1, 2],+ ]);++ const numRows4 = StringValueObject.create('test');+ const result4 = testFunction.calculate(inputRange, numRows4, numCols);+ expect(getObjectValue(result4)).toBe(ErrorType.VALUE);++ const numRows5 = ErrorValueObject.create(ErrorType.NAME);+ const result5 = testFunction.calculate(inputRange, numRows5, numCols);+ expect(getObjectValue(result5)).toBe(ErrorType.NAME);++ const numRows6 = NumberValueObject.create(222);+ const result6 = testFunction.calculate(inputRange, numRows6, numCols);+ expect(getObjectValue(result6)).toStrictEqual([+ [1, 2],+ [4, 5],+ [7, 8],+ ]);+ });+ });+});diff --git a/packages/engine-formula/src/functions/array/array-constrain/index.ts b/packages/engine-formula/src/functions/array/array-constrain/index.tsnew file mode 100644index 0000000000..33b82a4f05--- /dev/null+++ b/packages/engine-formula/src/functions/array/array-constrain/index.ts@@ -0,0 +1,71 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { ArrayValueObject } from '../../../engine/value-object/array-value-object';+import type { BaseValueObject } from '../../../engine/value-object/base-value-object';+import { ErrorType } from '../../../basics/error-type';+import { checkVariantsErrorIsArray, checkVariantsErrorIsStringToNumber } from '../../../engine/utils/check-variant-error';+import { ErrorValueObject } from '../../../engine/value-object/base-value-object';+import { BaseFunction } from '../../base-function';++export class ArrayConstrain extends BaseFunction {+ override minParams = 3;++ override maxParams = 3;++ override calculate(inputRange: BaseValueObject, numRows: BaseValueObject, numCols: BaseValueObject): BaseValueObject {+ if (inputRange.isError()) {+ return inputRange;+ }++ const { isError, errorObject, variants } = checkVariantsErrorIsArray(numRows, numCols);++ if (isError) {+ return errorObject as ErrorValueObject;+ }++ const { isError: _isError, errorObject: _errorObject, variants: _variants } = checkVariantsErrorIsStringToNumber(...variants as BaseValueObject[]);++ if (_isError) {+ return _errorObject as ErrorValueObject;+ }++ const [numRowsObject, numColsObject] = _variants as BaseValueObject[];++ const numRowsValue = Math.floor(+numRowsObject.getValue());+ const numColsValue = Math.floor(+numColsObject.getValue());++ if (numRowsValue < 0 || numColsValue < 0) {+ return ErrorValueObject.create(ErrorType.NUM);+ }++ if (numRowsValue === 0 || numColsValue === 0) {+ return ErrorValueObject.create(ErrorType.REF);+ }++ const rowCount = inputRange.isArray() ? (inputRange as ArrayValueObject).getRowCount() : 1;+ const columnCount = inputRange.isArray() ? (inputRange as ArrayValueObject).getColumnCount() : 1;++ if (rowCount === 1 && columnCount === 1) {+ return inputRange.isArray() ? (inputRange as ArrayValueObject).get(0, 0) as BaseValueObject : inputRange;+ }++ const maxRowCount = numRowsValue > rowCount ? rowCount : numRowsValue;+ const maxColumnCount = numColsValue > columnCount ? columnCount : numColsValue;++ return (inputRange as ArrayValueObject).slice([0, maxRowCount], [0, maxColumnCount]) as ArrayValueObject;+ }+}diff --git a/packages/engine-formula/src/functions/array/flatten/__tests__/index.spec.ts b/packages/engine-formula/src/functions/array/flatten/__tests__/index.spec.tsnew file mode 100644index 0000000000..b0bf829444--- /dev/null+++ b/packages/engine-formula/src/functions/array/flatten/__tests__/index.spec.ts@@ -0,0 +1,80 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { describe, expect, it } from 'vitest';++import { ErrorType } from '../../../../basics/error-type';+import { ArrayValueObject, transformToValueObject } from '../../../../engine/value-object/array-value-object';+import { NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';+import { getObjectValue } from '../../../__tests__/create-function-test-bed';+import { FUNCTION_NAMES_ARRAY } from '../../function-names';+import { Flatten } from '../index';++describe('Test flatten function', () => {+ const testFunction = new Flatten(FUNCTION_NAMES_ARRAY.FLATTEN);++ describe('Flatten', () => {+ it('Value is normal', () => {+ const range1 = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [1, 2, 3],+ ]),+ rowCount: 1,+ columnCount: 3,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const range2 = NumberValueObject.create(4);+ const result = testFunction.calculate(range1, range2);+ expect(getObjectValue(result)).toStrictEqual([+ [1],+ [2],+ [3],+ [4],+ ]);+ });++ it('Value is array', () => {+ const range1 = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [1, true, false, null],+ [0, '100', -3, ErrorType.NAME],+ ]),+ rowCount: 2,+ columnCount: 4,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const range2 = StringValueObject.create('test');+ const result = testFunction.calculate(range1, range2);+ expect(getObjectValue(result)).toStrictEqual([+ [1],+ [true],+ [false],+ [0],+ [0],+ [100],+ [-3],+ [ErrorType.NAME],+ ['test'],+ ]);+ });+ });+});diff --git a/packages/engine-formula/src/functions/array/flatten/index.ts b/packages/engine-formula/src/functions/array/flatten/index.tsnew file mode 100644index 0000000000..f77f8b4afb--- /dev/null+++ b/packages/engine-formula/src/functions/array/flatten/index.ts@@ -0,0 +1,52 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { BaseValueObject } from '../../../engine/value-object/base-value-object';+import { ArrayValueObject } from '../../../engine/value-object/array-value-object';+import { BaseFunction } from '../../base-function';++export class Flatten extends BaseFunction {+ override minParams = 1;++ override maxParams = 255;++ override calculate(...variants: BaseValueObject[]): BaseValueObject {+ const resultArray: BaseValueObject[][] = [];++ for (let i = 0; i < variants.length; i++) {+ const variant = variants[i];+ const rowCount = variant.isArray() ? (variant as ArrayValueObject).getRowCount() : 1;+ const columnCount = variant.isArray() ? (variant as ArrayValueObject).getColumnCount() : 1;++ for (let r = 0; r < rowCount; r++) {+ for (let c = 0; c < columnCount; c++) {+ const valueObject = variant.isArray() ? (variant as ArrayValueObject).get(r, c) as BaseValueObject : variant;+ resultArray.push([valueObject]);+ }+ }+ }++ return ArrayValueObject.create({+ calculateValueList: resultArray,+ rowCount: resultArray.length,+ columnCount: 1,+ unitId: this.unitId as string,+ sheetId: this.subUnitId as string,+ row: this.row,+ column: this.column,+ });+ }+}diff --git a/packages/engine-formula/src/functions/array/function-map.ts b/packages/engine-formula/src/functions/array/function-map.tsindex 86e577d447..4d669fe854 100644--- a/packages/engine-formula/src/functions/array/function-map.ts+++ b/packages/engine-formula/src/functions/array/function-map.ts@@ -14,4 +14,11 @@* limitations under the License.*/-export const functionArray = [];+import { ArrayConstrain } from './array-constrain';+import { Flatten } from './flatten';+import { FUNCTION_NAMES_ARRAY } from './function-names';++export const functionArray = [+ [ArrayConstrain, FUNCTION_NAMES_ARRAY.ARRAY_CONSTRAIN],+ [Flatten, FUNCTION_NAMES_ARRAY.FLATTEN],+];diff --git a/packages/engine-formula/src/functions/array/function-names.ts b/packages/engine-formula/src/functions/array/function-names.tsindex ddb8a624f8..ff99877fae 100644--- a/packages/engine-formula/src/functions/array/function-names.ts+++ b/packages/engine-formula/src/functions/array/function-names.ts@@ -14,4 +14,7 @@* limitations under the License.*/-export enum FUNCTION_NAMES_ARRAY {}+export enum FUNCTION_NAMES_ARRAY {+ ARRAY_CONSTRAIN = 'ARRAY_CONSTRAIN',+ FLATTEN = 'FLATTEN',+}diff --git a/packages/sheets-formula-ui/src/locale/function-list/array/en-US.ts b/packages/sheets-formula-ui/src/locale/function-list/array/en-US.tsindex 1c4630e861..7653355c62 100644--- a/packages/sheets-formula-ui/src/locale/function-list/array/en-US.ts+++ b/packages/sheets-formula-ui/src/locale/function-list/array/en-US.ts@@ -14,4 +14,34 @@* limitations under the License.*/-export default {};+export default {+ ARRAY_CONSTRAIN: {+ description: 'Constrains an array result to a specified size.',+ abstract: 'Constrains an array result to a specified size.',+ links: [+ {+ title: 'Instruction',+ url: 'https://support.google.com/docs/answer/3267036?hl=en&sjid=8484774178571403392-AP',+ },+ ],+ functionParameter: {+ inputRange: { name: 'input_range', detail: 'The range to constrain.' },+ numRows: { name: 'num_rows', detail: 'The number of rows the result should contain.' },+ numCols: { name: 'num_cols', detail: 'The number of columns the result should contain' },+ },+ },+ FLATTEN: {+ description: 'Flattens all the values from one or more ranges into a single column.',+ abstract: 'Flattens all the values from one or more ranges into a single column.',+ links: [+ {+ title: 'Instruction',+ url: 'https://support.google.com/docs/answer/10307761?hl=zh-Hans&sjid=17375453483079636084-AP',+ },+ ],+ functionParameter: {+ range1: { name: 'range1', detail: 'The first range to flatten.' },+ range2: { name: 'range2', detail: 'Additional ranges to flatten.' },+ },+ },+};diff --git a/packages/sheets-formula-ui/src/locale/function-list/array/ja-JP.ts b/packages/sheets-formula-ui/src/locale/function-list/array/ja-JP.tsindex 1c4630e861..3ad3a18b9f 100644--- a/packages/sheets-formula-ui/src/locale/function-list/array/ja-JP.ts+++ b/packages/sheets-formula-ui/src/locale/function-list/array/ja-JP.ts@@ -14,4 +14,34 @@* limitations under the License.*/-export default {};+export default {+ ARRAY_CONSTRAIN: {+ description: '配列の結果を指定したサイズに抑えます',+ abstract: '配列の結果を指定したサイズに抑えます',+ links: [+ {+ title: '指導',+ url: 'https://support.google.com/docs/answer/3267036?hl=ja&sjid=8484774178571403392-AP',+ },+ ],+ functionParameter: {+ inputRange: { name: '配列', detail: '制約対象の範囲です。' },+ numRows: { name: '行の数', detail: '結果に含める行の数です。' },+ numCols: { name: '列の数', detail: '結果に含める列の数です。' },+ },+ },+ FLATTEN: {+ description: '1 つ以上の範囲に含まれるすべての値を、単一の列にフラット化します',+ abstract: '1 つ以上の範囲に含まれるすべての値を、単一の列にフラット化します',+ links: [+ {+ title: '指導',+ url: 'https://support.google.com/docs/answer/10307761?hl=ja&sjid=17375453483079636084-AP',+ },+ ],+ functionParameter: {+ range1: { name: '範囲1', detail: 'フラット化する最初の範囲です。' },+ range2: { name: '範囲2', detail: 'フラット化する追加の範囲です。' },+ },+ },+};diff --git a/packages/sheets-formula-ui/src/locale/function-list/array/ru-RU.ts b/packages/sheets-formula-ui/src/locale/function-list/array/ru-RU.tsindex 5a3d76c357..1e44629db5 100644--- a/packages/sheets-formula-ui/src/locale/function-list/array/ru-RU.ts+++ b/packages/sheets-formula-ui/src/locale/function-list/array/ru-RU.ts@@ -14,8 +14,34 @@* limitations under the License.*/-import enUS from './en-US';--export default enUS;--// export default {};+export default {+ ARRAY_CONSTRAIN: {+ description: 'Задает размер массива, в который будут помещены результаты.',+ abstract: 'Задает размер массива, в который будут помещены результаты.',+ links: [+ {+ title: 'Инструкция',+ url: 'https://support.google.com/docs/answer/3267036?hl=ru&sjid=8484774178571403392-AP',+ },+ ],+ functionParameter: {+ inputRange: { name: 'массива', detail: 'диапазон для ограничения.' },+ numRows: { name: 'количество_строк', detail: 'количество строк, которое должен содержать результат.' },+ numCols: { name: 'количество_столбцов', detail: 'количество столбцов, которое должен содержать результат.' },+ },+ },+ FLATTEN: {+ description: 'Объединяет все значения из одного или нескольких диапазонов в один столбец.',+ abstract: 'Объединяет все значения из одного или нескольких диапазонов в один столбец.',+ links: [+ {+ title: 'Инструкция',+ url: 'https://support.google.com/docs/answer/10307761?hl=ru&sjid=17375453483079636084-AP',+ },+ ],+ functionParameter: {+ range1: { name: 'диапазон1', detail: 'Первый диапазон, который необходимо выровнять.' },+ range2: { name: 'диапазон2', detail: 'Дополнительные диапазоны, которые необходимо выровнять.' },+ },+ },+};diff --git a/packages/sheets-formula-ui/src/locale/function-list/array/vi-VN.ts b/packages/sheets-formula-ui/src/locale/function-list/array/vi-VN.tsindex 1c4630e861..0711afc6d3 100644--- a/packages/sheets-formula-ui/src/locale/function-list/array/vi-VN.ts+++ b/packages/sheets-formula-ui/src/locale/function-list/array/vi-VN.ts@@ -14,4 +14,34 @@* limitations under the License.*/-export default {};+export default {+ ARRAY_CONSTRAIN: {+ description: 'Ràng buộc giá trị mảng vào một kích thước chỉ định sẵn.',+ abstract: 'Ràng buộc giá trị mảng vào một kích thước chỉ định sẵn.',+ links: [+ {+ title: 'Giảng dạy',+ url: 'https://support.google.com/docs/answer/3267036?hl=vi&sjid=8484774178571403392-AP',+ },+ ],+ functionParameter: {+ inputRange: { name: 'mảng', detail: 'Dải ô giới hạn.' },+ numRows: { name: 'số hàng', detail: 'Số hàng mà kết quả cần có.' },+ numCols: { name: 'số cột', detail: 'Số cột mà kết quả cần có' },+ },+ },+ FLATTEN: {+ description: 'Làm phẳng tất cả giá trị trong một hoặc nhiều dải ô thành một cột duy nhất.',+ abstract: 'Làm phẳng tất cả giá trị trong một hoặc nhiều dải ô thành một cột duy nhất.',+ links: [+ {+ title: 'Giảng dạy',+ url: 'https://support.google.com/docs/answer/10307761?hl=vi&sjid=17375453483079636084-AP',+ },+ ],+ functionParameter: {+ range1: { name: 'dải ô 1', detail: 'Dải ô đầu tiên cần làm phẳng.' },+ range2: { name: 'dải ô 2', detail: 'Các dải ô bổ sung để làm phẳng.' },+ },+ },+};diff --git a/packages/sheets-formula-ui/src/locale/function-list/array/zh-CN.ts b/packages/sheets-formula-ui/src/locale/function-list/array/zh-CN.tsindex 1c4630e861..a42fa33c2c 100644--- a/packages/sheets-formula-ui/src/locale/function-list/array/zh-CN.ts+++ b/packages/sheets-formula-ui/src/locale/function-list/array/zh-CN.ts@@ -14,4 +14,34 @@* limitations under the License.*/-export default {};+export default {+ ARRAY_CONSTRAIN: {+ description: '以给定值约束数组结果的大小',+ abstract: '以给定值约束数组结果的大小',+ links: [+ {+ title: '教学',+ url: 'https://support.google.com/docs/answer/3267036?hl=zh-Hans&sjid=8484774178571403392-AP',+ },+ ],+ functionParameter: {+ inputRange: { name: '数组', detail: '要约束的范围。' },+ numRows: { name: '行数', detail: '结果中应包含的行数。' },+ numCols: { name: '列数', detail: '结果中应包含的列数。' },+ },+ },+ FLATTEN: {+ description: '将一个或多个范围中的所有值合并到单列',+ abstract: '将一个或多个范围中的所有值合并到单列',+ links: [+ {+ title: '教学',+ url: 'https://support.google.com/docs/answer/10307761?hl=zh-Hans&sjid=17375453483079636084-AP',+ },+ ],+ functionParameter: {+ range1: { name: '范围1', detail: '要合并的第一个范围。' },+ range2: { name: '范围2', detail: '要合并的其他范围。' },+ },+ },+};diff --git a/packages/sheets-formula-ui/src/locale/function-list/array/zh-TW.ts b/packages/sheets-formula-ui/src/locale/function-list/array/zh-TW.tsindex 1c4630e861..927c64c282 100644--- a/packages/sheets-formula-ui/src/locale/function-list/array/zh-TW.ts+++ b/packages/sheets-formula-ui/src/locale/function-list/array/zh-TW.ts@@ -14,4 +14,34 @@* limitations under the License.*/-export default {};+export default {+ ARRAY_CONSTRAIN: {+ description: '限制特定大小的陣列結果',+ abstract: '限制特定大小的陣列結果',+ links: [+ {+ title: '教導',+ url: 'https://support.google.com/docs/answer/3267036?hl=zh-Hant&sjid=8484774178571403392-AP',+ },+ ],+ functionParameter: {+ inputRange: { name: '陣列', detail: '限制的範圍。' },+ numRows: { name: '列數', detail: '結果所包含的列數。' },+ numCols: { name: '欄數', detail: '結果所包含的欄數。' },+ },+ },+ FLATTEN: {+ description: '將一或多個範圍中的所有值合併至單一欄',+ abstract: '將一或多個範圍中的所有值合併至單一欄',+ links: [+ {+ title: '教導',+ url: 'https://support.google.com/docs/answer/10307761?hl=zh-Hant&sjid=17375453483079636084-AP',+ },+ ],+ functionParameter: {+ range1: { name: '範圍1', detail: '第一個要合併的範圍。' },+ range2: { name: '範圍2', detail: '其他要合併的範圍。' },+ },+ },+};diff --git a/packages/sheets-formula/src/services/function-list/array.ts b/packages/sheets-formula/src/services/function-list/array.tsindex 75ad205905..63244c341e 100644--- a/packages/sheets-formula/src/services/function-list/array.ts+++ b/packages/sheets-formula/src/services/function-list/array.ts@@ -15,5 +15,58 @@*/import type { IFunctionInfo } from '@univerjs/engine-formula';+import { FUNCTION_NAMES_ARRAY, FunctionType } from '@univerjs/engine-formula';-export const FUNCTION_LIST_ARRAY: IFunctionInfo[] = [];+export const FUNCTION_LIST_ARRAY: IFunctionInfo[] = [+ {+ functionName: FUNCTION_NAMES_ARRAY.ARRAY_CONSTRAIN,+ functionType: FunctionType.Array,+ description: 'formula.functionList.ARRAY_CONSTRAIN.description',+ abstract: 'formula.functionList.ARRAY_CONSTRAIN.abstract',+ functionParameter: [+ {+ name: 'formula.functionList.ARRAY_CONSTRAIN.functionParameter.inputRange.name',+ detail: 'formula.functionList.ARRAY_CONSTRAIN.functionParameter.inputRange.detail',+ example: 'A1:C3',+ require: 1,+ repeat: 0,+ },+ {+ name: 'formula.functionList.ARRAY_CONSTRAIN.functionParameter.numRows.name',+ detail: 'formula.functionList.ARRAY_CONSTRAIN.functionParameter.numRows.detail',+ example: '2',+ require: 1,+ repeat: 0,+ },+ {+ name: 'formula.functionList.ARRAY_CONSTRAIN.functionParameter.numCols.name',+ detail: 'formula.functionList.ARRAY_CONSTRAIN.functionParameter.numCols.detail',+ example: '2',+ require: 1,+ repeat: 0,+ },+ ],+ },+ {+ functionName: FUNCTION_NAMES_ARRAY.FLATTEN,+ functionType: FunctionType.Array,+ description: 'formula.functionList.FLATTEN.description',+ abstract: 'formula.functionList.FLATTEN.abstract',+ functionParameter: [+ {+ name: 'formula.functionList.FLATTEN.functionParameter.range1.name',+ detail: 'formula.functionList.FLATTEN.functionParameter.range1.detail',+ example: 'A1:C3',+ require: 1,+ repeat: 0,+ },+ {+ name: 'formula.functionList.FLATTEN.functionParameter.range2.name',+ detail: 'formula.functionList.FLATTEN.functionParameter.range2.detail',+ example: 'D1:F3',+ require: 0,+ repeat: 1,+ },+ ],+ },+];