From 834d0e34cc8c4482a6a3abbaea3450a2f6800420 Mon Sep 17 00:00:00 2001 From: srleng Date: Mon, 23 May 2022 13:58:43 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=8E=92=E5=BA=8F=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=B8=AD=E9=97=B4=E6=80=81=20orderDir=20=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E7=BD=AE=E7=A9=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/table.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/store/table.ts b/src/store/table.ts index 3db43f23e56..198ec655197 100644 --- a/src/store/table.ts +++ b/src/store/table.ts @@ -285,7 +285,7 @@ export const TableStore = iRendererStore primaryField: 'id', orderBy: '', orderDir: types.optional( - types.union(types.literal('asc'), types.literal('desc')), + types.union(types.literal('asc'), types.literal('desc'),types.literal('')), 'asc' ), draggable: false, @@ -1274,9 +1274,9 @@ export const TableStore = iRendererStore self.expandedRows.replace(rows.map(item => item.id)); } - function setOrderByInfo(key: string, direction: 'asc' | 'desc') { + function setOrderByInfo(key: string, direction: 'asc' | 'desc' | '') { self.orderBy = key; - self.orderDir = direction; + self.orderDir = key ? direction : '' ; } function reset() { From f721fce13e4dc7cf56859005cefdee6ad23da0d2 Mon Sep 17 00:00:00 2001 From: srleng Date: Mon, 23 May 2022 15:53:00 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 3 ++ src/store/table.ts | 106 +++++++++++++++++++++--------------------- 2 files changed, 56 insertions(+), 53 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 8266caef5e1..dfb0ab4d6bf 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,8 @@ "search.exclude": { "examples/docs.json": true, "examples/components/EChartsEditor/option-parts/**/*": true + }, + "[typescript]": { + "editor.defaultFormatter": "vscode.typescript-language-features" } } diff --git a/src/store/table.ts b/src/store/table.ts index 198ec655197..938b6962fb9 100644 --- a/src/store/table.ts +++ b/src/store/table.ts @@ -9,8 +9,8 @@ import { isAlive, Instance } from 'mobx-state-tree'; -import {iRendererStore} from './iRenderer'; -import {resolveVariable, resolveVariableAndFilter} from '../utils/tpl-builtin'; +import { iRendererStore } from './iRenderer'; +import { resolveVariable, resolveVariableAndFilter } from '../utils/tpl-builtin'; import isEqual from 'lodash/isEqual'; import find from 'lodash/find'; import sortBy from 'lodash/sortBy'; @@ -29,11 +29,11 @@ import { hasVisibleExpression, filterTree } from '../utils/helper'; -import {evalExpression} from '../utils/tpl'; -import {IFormStore} from './form'; -import {getStoreById} from './manager'; +import { evalExpression } from '../utils/tpl'; +import { IFormStore } from './form'; +import { getStoreById } from './manager'; -import type {SchemaObject} from '../Schema'; +import type { SchemaObject } from '../Schema'; /** * 内部列的数量 '__checkme' | '__dragme' | '__expandme' @@ -185,9 +185,9 @@ export const Row = types }), children ? { - ...self.data, - children - } + ...self.data, + children + } : self.data ); }, @@ -285,7 +285,7 @@ export const TableStore = iRendererStore primaryField: 'id', orderBy: '', orderDir: types.optional( - types.union(types.literal('asc'), types.literal('desc'),types.literal('')), + types.union(types.literal('asc'), types.literal('desc'), types.literal('')), 'asc' ), draggable: false, @@ -330,14 +330,14 @@ export const TableStore = iRendererStore ) && (item.type === '__checkme' ? self.selectable && - !self.dragging && - !self.hideCheckToggler && - self.rows.length + !self.dragging && + !self.hideCheckToggler && + self.rows.length : item.type === '__dragme' - ? self.dragging - : item.type === '__expandme' - ? (getFootableColumns().length || self.isNested) && !self.dragging - : item.toggled || !item.toggable) + ? self.dragging + : item.type === '__expandme' + ? (getFootableColumns().length || self.isNested) && !self.dragging + : item.toggled || !item.toggable) ); }); } @@ -352,30 +352,30 @@ export const TableStore = iRendererStore ) && (item.type === '__checkme' ? self.selectable && - !self.dragging && - !self.hideCheckToggler && - self.rows.length + !self.dragging && + !self.hideCheckToggler && + self.rows.length : item.type === '__dragme' - ? self.dragging - : item.type === '__expandme' - ? (getFootableColumns().length || self.isNested) && !self.dragging - : (item.toggled || !item.toggable) && - (!self.footable || - !item.breakpoint || - !isBreakpoint(item.breakpoint))) + ? self.dragging + : item.type === '__expandme' + ? (getFootableColumns().length || self.isNested) && !self.dragging + : (item.toggled || !item.toggable) && + (!self.footable || + !item.breakpoint || + !isBreakpoint(item.breakpoint))) ); } function getFootableColumns() { return self.columns.filter(item => item.type === '__checkme' || - item.type === '__dragme' || - item.type === '__expandme' + item.type === '__dragme' || + item.type === '__expandme' ? false : (item.toggled || !item.toggable) && - self.footable && - item.breakpoint && - isBreakpoint(item.breakpoint) + self.footable && + item.breakpoint && + isBreakpoint(item.breakpoint) ); } @@ -492,14 +492,14 @@ export const TableStore = iRendererStore rowSpan: number; has: Array; }> = [ - { - label: columns[0].groupName, - colSpan: 1, - rowSpan: 1, - index: columns[0].index, - has: [columns[0]] - } - ]; + { + label: columns[0].groupName, + colSpan: 1, + rowSpan: 1, + index: columns[0].index, + has: [columns[0]] + } + ]; // 如果是勾选栏,让它和下一列合并。 if (columns[0].type === '__checkme' && columns[1]) { @@ -516,7 +516,7 @@ export const TableStore = iRendererStore const groupNameIsSame = current.groupName === prev.label || resolveVariableAndFilter(current.groupName, self.data) === - resolveVariableAndFilter(prev.label, self.data); + resolveVariableAndFilter(prev.label, self.data); if ( groupNameIsSame && @@ -542,7 +542,7 @@ export const TableStore = iRendererStore return groups.map(item => { const rowSpan = !item.label || - (item.has.length === 1 && item.label === item.has[0].label) + (item.has.length === 1 && item.label === item.has[0].label) ? 2 : 1; return { @@ -618,7 +618,7 @@ export const TableStore = iRendererStore get allChecked(): boolean { return !!( self.selectedRows.length === - (self as ITableStore).checkableRows.length && + (self as ITableStore).checkableRows.length && (self as ITableStore).checkableRows.length ); }, @@ -779,7 +779,7 @@ export const TableStore = iRendererStore if (data) { try { tableMetaData = JSON.parse(data); - } catch (error) {} + } catch (error) { } const order = tableMetaData?.columnOrder; @@ -966,8 +966,8 @@ export const TableStore = iRendererStore item = isObject(item) ? item : { - item - }; + item + }; const id = item.__id ?? guid(); return { @@ -985,12 +985,12 @@ export const TableStore = iRendererStore children: item && Array.isArray(item.children) ? initChildren( - item.children, - depth, - index, - id, - `${path}${index}.` - ) + item.children, + depth, + index, + id, + `${path}${index}.` + ) : [], expandable: !!( (item && Array.isArray(item.children) && item.children.length) || @@ -1276,7 +1276,7 @@ export const TableStore = iRendererStore function setOrderByInfo(key: string, direction: 'asc' | 'desc' | '') { self.orderBy = key; - self.orderDir = key ? direction : '' ; + self.orderDir = key ? direction : ''; } function reset() { From 6adf08eb75d8ba9bdefae88d4dd9e31ec4c677ed Mon Sep 17 00:00:00 2001 From: srleng Date: Mon, 23 May 2022 16:58:24 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=8E=BB=E6=8E=89=20setting.json=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=20=E9=87=8C=E7=9A=84ts=20=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index dfb0ab4d6bf..8266caef5e1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,8 +7,5 @@ "search.exclude": { "examples/docs.json": true, "examples/components/EChartsEditor/option-parts/**/*": true - }, - "[typescript]": { - "editor.defaultFormatter": "vscode.typescript-language-features" } } From 57959bb3fe5f28e07c3f0b151f88aac08b0b620c Mon Sep 17 00:00:00 2001 From: srleng Date: Wed, 1 Jun 2022 14:50:16 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/table.ts | 108 +++++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 52 deletions(-) diff --git a/src/store/table.ts b/src/store/table.ts index 938b6962fb9..f976b1e7239 100644 --- a/src/store/table.ts +++ b/src/store/table.ts @@ -9,8 +9,8 @@ import { isAlive, Instance } from 'mobx-state-tree'; -import { iRendererStore } from './iRenderer'; -import { resolveVariable, resolveVariableAndFilter } from '../utils/tpl-builtin'; +import {iRendererStore} from './iRenderer'; +import {resolveVariable, resolveVariableAndFilter} from '../utils/tpl-builtin'; import isEqual from 'lodash/isEqual'; import find from 'lodash/find'; import sortBy from 'lodash/sortBy'; @@ -29,11 +29,11 @@ import { hasVisibleExpression, filterTree } from '../utils/helper'; -import { evalExpression } from '../utils/tpl'; -import { IFormStore } from './form'; -import { getStoreById } from './manager'; +import {evalExpression} from '../utils/tpl'; +import {IFormStore} from './form'; +import {getStoreById} from './manager'; -import type { SchemaObject } from '../Schema'; +import type {SchemaObject} from '../Schema'; /** * 内部列的数量 '__checkme' | '__dragme' | '__expandme' @@ -185,9 +185,9 @@ export const Row = types }), children ? { - ...self.data, - children - } + ...self.data, + children + } : self.data ); }, @@ -285,7 +285,11 @@ export const TableStore = iRendererStore primaryField: 'id', orderBy: '', orderDir: types.optional( - types.union(types.literal('asc'), types.literal('desc'), types.literal('')), + types.union( + types.literal('asc'), + types.literal('desc'), + types.literal('') + ), 'asc' ), draggable: false, @@ -330,14 +334,14 @@ export const TableStore = iRendererStore ) && (item.type === '__checkme' ? self.selectable && - !self.dragging && - !self.hideCheckToggler && - self.rows.length + !self.dragging && + !self.hideCheckToggler && + self.rows.length : item.type === '__dragme' - ? self.dragging - : item.type === '__expandme' - ? (getFootableColumns().length || self.isNested) && !self.dragging - : item.toggled || !item.toggable) + ? self.dragging + : item.type === '__expandme' + ? (getFootableColumns().length || self.isNested) && !self.dragging + : item.toggled || !item.toggable) ); }); } @@ -352,30 +356,30 @@ export const TableStore = iRendererStore ) && (item.type === '__checkme' ? self.selectable && - !self.dragging && - !self.hideCheckToggler && - self.rows.length + !self.dragging && + !self.hideCheckToggler && + self.rows.length : item.type === '__dragme' - ? self.dragging - : item.type === '__expandme' - ? (getFootableColumns().length || self.isNested) && !self.dragging - : (item.toggled || !item.toggable) && - (!self.footable || - !item.breakpoint || - !isBreakpoint(item.breakpoint))) + ? self.dragging + : item.type === '__expandme' + ? (getFootableColumns().length || self.isNested) && !self.dragging + : (item.toggled || !item.toggable) && + (!self.footable || + !item.breakpoint || + !isBreakpoint(item.breakpoint))) ); } function getFootableColumns() { return self.columns.filter(item => item.type === '__checkme' || - item.type === '__dragme' || - item.type === '__expandme' + item.type === '__dragme' || + item.type === '__expandme' ? false : (item.toggled || !item.toggable) && - self.footable && - item.breakpoint && - isBreakpoint(item.breakpoint) + self.footable && + item.breakpoint && + isBreakpoint(item.breakpoint) ); } @@ -492,14 +496,14 @@ export const TableStore = iRendererStore rowSpan: number; has: Array; }> = [ - { - label: columns[0].groupName, - colSpan: 1, - rowSpan: 1, - index: columns[0].index, - has: [columns[0]] - } - ]; + { + label: columns[0].groupName, + colSpan: 1, + rowSpan: 1, + index: columns[0].index, + has: [columns[0]] + } + ]; // 如果是勾选栏,让它和下一列合并。 if (columns[0].type === '__checkme' && columns[1]) { @@ -516,7 +520,7 @@ export const TableStore = iRendererStore const groupNameIsSame = current.groupName === prev.label || resolveVariableAndFilter(current.groupName, self.data) === - resolveVariableAndFilter(prev.label, self.data); + resolveVariableAndFilter(prev.label, self.data); if ( groupNameIsSame && @@ -542,7 +546,7 @@ export const TableStore = iRendererStore return groups.map(item => { const rowSpan = !item.label || - (item.has.length === 1 && item.label === item.has[0].label) + (item.has.length === 1 && item.label === item.has[0].label) ? 2 : 1; return { @@ -618,7 +622,7 @@ export const TableStore = iRendererStore get allChecked(): boolean { return !!( self.selectedRows.length === - (self as ITableStore).checkableRows.length && + (self as ITableStore).checkableRows.length && (self as ITableStore).checkableRows.length ); }, @@ -779,7 +783,7 @@ export const TableStore = iRendererStore if (data) { try { tableMetaData = JSON.parse(data); - } catch (error) { } + } catch (error) {} const order = tableMetaData?.columnOrder; @@ -966,8 +970,8 @@ export const TableStore = iRendererStore item = isObject(item) ? item : { - item - }; + item + }; const id = item.__id ?? guid(); return { @@ -985,12 +989,12 @@ export const TableStore = iRendererStore children: item && Array.isArray(item.children) ? initChildren( - item.children, - depth, - index, - id, - `${path}${index}.` - ) + item.children, + depth, + index, + id, + `${path}${index}.` + ) : [], expandable: !!( (item && Array.isArray(item.children) && item.children.length) || From 9ec52a5d91653bd2bbe0f0bda0baf1c8163103e2 Mon Sep 17 00:00:00 2001 From: srleng Date: Thu, 7 Sep 2023 16:46:20 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B8=85=E9=99=A4?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/zh-CN/components/form/input-formula.md | 67 +- examples/polyfills/index.ts | 8 +- package.json | 3 +- packages/amis-formula/src/doc.ts | 2032 ++++++++--------- .../amis-ui/src/components/formula/Editor.tsx | 24 +- .../amis-ui/src/components/formula/Picker.tsx | 9 + .../renderers/Form/inputFormula.test.tsx | 1 - .../amis/src/renderers/Form/InputFormula.tsx | 14 +- 8 files changed, 1075 insertions(+), 1083 deletions(-) diff --git a/docs/zh-CN/components/form/input-formula.md b/docs/zh-CN/components/form/input-formula.md index 413115a7c07..52314979ca2 100644 --- a/docs/zh-CN/components/form/input-formula.md +++ b/docs/zh-CN/components/form/input-formula.md @@ -12,13 +12,25 @@ order: 21 用来输入公式。还是 beta 版本,整体待优化。 -```schema: scope="body" +```schema: { "type": "form", "debug": true, "body": [ { "type": "input-formula", + "functions": [ + { + "groupName": "mysql", + "items": [ + { + "name": "sum", + "example": "SUM(1,X)", + "description":"求和" + } + ] + } + ], "name": "formula", "label": "公式", "evalMode": true, @@ -92,7 +104,7 @@ order: 21 设置`"inputMode": "button"`可以切换编辑器的展示模式为按钮模式。 -```schema: scope="body" +```schema: { "type": "form", "debug": true, @@ -162,7 +174,7 @@ order: 21 设置`"inputMode": "input-group"`可以切换编辑器的展示模式为输入框组合模式,1.10.0 及以上版本。 -```schema: scope="body" +```schema: { "type": "form", "debug": true, @@ -234,7 +246,7 @@ order: 21 设置不同`variableMode`字段切换变量展示模式,树形结构: -```schema: scope="body" +```schema: { "type": "form", "debug": true, @@ -302,7 +314,7 @@ order: 21 Tab 结构: -```schema: scope="body" +```schema: { "type": "form", "debug": true, @@ -372,7 +384,7 @@ Tab 结构: 通过配置`allowInput`为`false`可以高亮文本内容,但是只能在编辑器中编辑 -```schema: scope="body" +```schema: { "type": "form", "debug": true, @@ -443,7 +455,7 @@ Tab 结构: 当配置 `evalMode` 为 false 时则为模板模式,意思是说默认不当做表达式,只有 `${`和`}`包裹的部分才是表达式。 -```schema: scope="body" +```schema: { "type": "form", "debug": true, @@ -513,7 +525,7 @@ Tab 结构: 混合模式的意思是支持输入文本和输入公式两种格式的值,当输入公式时值会自动用 `${` 和 `}` 包裹,如果不是这种格式则认为是输入普通的字符串。通过 `mixedMode` 为 true 启用这种模式 -```schema: scope="body" +```schema: { "type": "form", "debug": true, @@ -581,22 +593,23 @@ Tab 结构: ## 属性表 -| 属性名 | 类型 | 默认值 | 说明 | -| ----------------- | ------------------------------------------------------------------------------------------ | -------------- | ------------------------------------------------------------------------------ | -| title | `string` | `'公式编辑器'` | 弹框标题 | -| header | `string` | - | 编辑器 header 标题,如果不设置,默认使用表单项`label`字段 | -| evalMode | `boolean` | `true` | 表达式模式 或者 模板模式,模板模式则需要将表达式写在 `${` 和 `}` 中间。 | -| variables | `{label: string; value: string; children?: any[]; tag?: string}[]` | `[]` | 可用变量 | -| variableMode | `string` | `list` | 可配置成 `tabs` 或者 `tree` 默认为列表,支持分组。 | -| functions | `Object[]` | - | 可以不设置,默认就是 amis-formula 里面定义的函数,如果扩充了新的函数则需要指定 | -| inputMode | `'button' \| 'input-button' \| 'input-group'` | - | 控件的展示模式 | -| icon | `string` | - | 按钮图标,例如`fa fa-list` | -| btnLabel | `string` | `'公示编辑'` | 按钮文本,`inputMode`为`button`时生效 | -| level | `'info' \| 'success' \| 'warning' \| 'danger' \| 'link' \| 'primary' \| 'dark' \| 'light'` | `default` | 按钮样式 | -| allowInput | `boolean` | - | 输入框是否可输入 | -| btnSize | `'xs' \| 'sm' \| 'md' \| 'lg'` | - | 按钮大小 | -| borderMode | `'full' \| 'half' \| 'none'` | - | 输入框边框模式 | -| placeholder | `string` | `'暂无数据'` | 输入框占位符 | -| className | `string` | - | 控件外层 CSS 样式类名 | -| variableClassName | `string` | - | 变量面板 CSS 样式类名 | -| functionClassName | `string` | - | 函数面板 CSS 样式类名 | +| 属性名 | 类型 | 默认值 | 说明 | +| ------------------- | ------------------------------------------------------------------------------------------ | --------- | ---------------------------------------------- | +| title | `string` | `'公式编辑器'` | 弹框标题 | +| header | `string` | - | 编辑器 header 标题,如果不设置,默认使用表单项`label`字段 | +| evalMode | `boolean` | `true` | 表达式模式 或者 模板模式,模板模式则需要将表达式写在 `${` 和 `}` 中间。 | +| variables | `{label: string; value: string; children?: any[]; tag?: string}[]` | `[]` | 可用变量 | +| variableMode | `string` | `list` | 可配置成 `tabs` 或者 `tree` 默认为列表,支持分组。 | +| functions | `Object[]` | - | 可以不设置,默认就是 amis-formula 里面定义的函数,如果扩充了新的函数则需要指定 | +| clearDefaultFormula | boolean | false | 清除默认你公式,配合functions属性,创建需要的公式 | +| inputMode | `'button' \| 'input-button' \| 'input-group'` | - | 控件的展示模式 | +| icon | `string` | - | 按钮图标,例如`fa fa-list` | +| btnLabel | `string` | `'公示编辑'` | 按钮文本,`inputMode`为`button`时生效 | +| level | `'info' \| 'success' \| 'warning' \| 'danger' \| 'link' \| 'primary' \| 'dark' \| 'light'` | `default` | 按钮样式 | +| allowInput | `boolean` | - | 输入框是否可输入 | +| btnSize | `'xs' \| 'sm' \| 'md' \| 'lg'` | - | 按钮大小 | +| borderMode | `'full' \| 'half' \| 'none'` | - | 输入框边框模式 | +| placeholder | `string` | `'暂无数据'` | 输入框占位符 | +| className | `string` | - | 控件外层 CSS 样式类名 | +| variableClassName | `string` | - | 变量面板 CSS 样式类名 | +| functionClassName | `string` | - | 函数面板 CSS 样式类名 | diff --git a/examples/polyfills/index.ts b/examples/polyfills/index.ts index c729415d09f..be97e89b72b 100644 --- a/examples/polyfills/index.ts +++ b/examples/polyfills/index.ts @@ -14,7 +14,7 @@ import 'core-js/es/map'; import 'core-js/es/set'; import 'core-js/es/symbol'; -// @ts-ignore -import './cloest'; -// @ts-ignore -import './classList'; +// // @ts-ignore +// import './cloest'; +// // @ts-ignore +// import './classList'; diff --git a/package.json b/package.json index 482dfd3439e..2e78772764e 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,8 @@ }, "dependencies": { "postcss": "^8.4.14", - "qs": "6.9.7" + "qs": "6.9.7", + "rc-component": "^0.1.0" }, "devDependencies": { "@babel/generator": "^7.22.9", diff --git a/packages/amis-formula/src/doc.ts b/packages/amis-formula/src/doc.ts index eb31b70e3af..3353cbf8c05 100644 --- a/packages/amis-formula/src/doc.ts +++ b/packages/amis-formula/src/doc.ts @@ -17,1928 +17,1874 @@ export const doc: { namespace: string; }[] = [ { - name: 'IF', - description: - '如果满足条件condition,则返回consequent,否则返回alternate,支持多层嵌套IF函数。\n\n等价于直接用JS表达式如:condition ? consequent : alternate。', - example: 'IF(condition, consequent, alternate)', + name: "IF", + description: "如果满足条件condition,则返回consequent,否则返回alternate,支持多层嵌套IF函数。\n\n等价于直接用JS表达式如:condition ? consequent : alternate。", + example: "IF(condition, consequent, alternate)", params: [ { - type: 'expression', - name: 'condition', - description: '条件表达式。例如:语文成绩>80' + type: "expression", + name: "condition", + description: "条件表达式。例如:语文成绩>80" }, { - type: 'any', - name: 'consequent', - description: '条件判断通过的返回结果' + type: "any", + name: "consequent", + description: "条件判断通过的返回结果" }, { - type: 'any', - name: 'alternate', - description: '条件判断不通过的返回结果' + type: "any", + name: "alternate", + description: "条件判断不通过的返回结果" } ], returns: { - type: 'any', - description: '根据条件返回不同的结果' + type: "any", + description: "根据条件返回不同的结果" }, - namespace: '逻辑函数' + namespace: "逻辑函数" }, { - name: 'AND', - description: - '条件全部符合,返回 true,否则返回 false。\n\n示例:AND(语文成绩>80, 数学成绩>80),\n\n语文成绩和数学成绩都大于 80,则返回 true,否则返回 false,\n\n等价于直接用JS表达式如:语文成绩>80 && 数学成绩>80。', - example: 'AND(expression1, expression2, ...expressionN)', + name: "AND", + description: "条件全部符合,返回 true,否则返回 false。\n\n示例:AND(语文成绩>80, 数学成绩>80),\n\n语文成绩和数学成绩都大于 80,则返回 true,否则返回 false,\n\n等价于直接用JS表达式如:语文成绩>80 && 数学成绩>80。", + example: "AND(expression1, expression2, ...expressionN)", params: [ { - type: '...expression', - name: 'conditions', - description: - '条件表达式,多个用逗号隔开。例如:语文成绩>80, 数学成绩>80' + type: "...expression", + name: "conditions", + description: "条件表达式,多个用逗号隔开。例如:语文成绩>80, 数学成绩>80" } ], returns: { - type: 'boolean', + type: "boolean", description: null }, - namespace: '逻辑函数' + namespace: "逻辑函数" }, { - name: 'OR', - description: - '条件任意一个满足条件,返回 true,否则返回 false。\n\n示例:OR(语文成绩>80, 数学成绩>80),\n\n语文成绩和数学成绩任意一个大于 80,则返回 true,否则返回 false,\n\n等价于直接用JS表达式如:语文成绩>80 || 数学成绩>80。', - example: 'OR(expression1, expression2, ...expressionN)', + name: "OR", + description: "条件任意一个满足条件,返回 true,否则返回 false。\n\n示例:OR(语文成绩>80, 数学成绩>80),\n\n语文成绩和数学成绩任意一个大于 80,则返回 true,否则返回 false,\n\n等价于直接用JS表达式如:语文成绩>80 || 数学成绩>80。", + example: "OR(expression1, expression2, ...expressionN)", params: [ { - type: '...expression', - name: 'conditions', - description: - '条件表达式,多个用逗号隔开。例如:语文成绩>80, 数学成绩>80' + type: "...expression", + name: "conditions", + description: "条件表达式,多个用逗号隔开。例如:语文成绩>80, 数学成绩>80" } ], returns: { - type: 'boolean', + type: "boolean", description: null }, - namespace: '逻辑函数' + namespace: "逻辑函数" }, { - name: 'XOR', - description: - '异或处理,多个表达式组中存在奇数个真时认为真。\n\n示例:XOR(语文成绩 > 80, 数学成绩 > 80, 英语成绩 > 80)\n\n三门成绩中有一门或者三门大于 80,则返回 true,否则返回 false。', - example: 'XOR(condition1, condition2, ...expressionN)', + name: "XOR", + description: "异或处理,多个表达式组中存在奇数个真时认为真。\n\n示例:XOR(语文成绩 > 80, 数学成绩 > 80, 英语成绩 > 80)\n\n三门成绩中有一门或者三门大于 80,则返回 true,否则返回 false。", + example: "XOR(condition1, condition2, ...expressionN)", params: [ { - type: '...expression', - name: 'condition', - description: - '条件表达式,多个用逗号隔开。例如:语文成绩>80, 数学成绩>80' + type: "...expression", + name: "condition", + description: "条件表达式,多个用逗号隔开。例如:语文成绩>80, 数学成绩>80" } ], returns: { - type: 'boolean', + type: "boolean", description: null }, - namespace: '逻辑函数' + namespace: "逻辑函数" }, { - name: 'IFS', - description: - '判断函数集合,相当于多个 else if 合并成一个。\n\n示例:IFS(语文成绩 > 80, "优秀", 语文成绩 > 60, "良", "继续努力"),\n\n如果语文成绩大于 80,则返回优秀,否则判断大于 60 分,则返回良,否则返回继续努力。', - example: - 'IFS(condition1, result1, condition2, result2,...conditionN, resultN)', + name: "IFS", + description: "判断函数集合,相当于多个 else if 合并成一个。\n\n示例:IFS(语文成绩 > 80, \"优秀\", 语文成绩 > 60, \"良\", \"继续努力\"),\n\n如果语文成绩大于 80,则返回优秀,否则判断大于 60 分,则返回良,否则返回继续努力。", + example: "IFS(condition1, result1, condition2, result2,...conditionN, resultN)", params: [ { - type: '...expression', - name: 'condition', - description: '条件表达式' + type: "...expression", + name: "condition", + description: "条件表达式" }, { - type: '...any', - name: 'result', - description: '返回值' + type: "...any", + name: "result", + description: "返回值" } ], returns: { - type: 'any', - description: '第一个满足条件的结果,没有命中的返回 false。' + type: "any", + description: "第一个满足条件的结果,没有命中的返回 false。" }, - namespace: '逻辑函数' + namespace: "逻辑函数" }, { - name: 'ABS', - description: '返回传入数字的绝对值。', - example: 'ABS(num)', + name: "ABS", + description: "返回传入数字的绝对值。", + example: "ABS(num)", params: [ { - type: 'number', - name: 'num', - description: '数值' + type: "number", + name: "num", + description: "数值" } ], returns: { - type: 'number', - description: '传入数值的绝对值' + type: "number", + description: "传入数值的绝对值" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'MAX', - description: '获取最大值,如果只有一个参数且是数组,则计算这个数组内的值。', - example: 'MAX(num1, num2, ...numN)', + name: "MAX", + description: "获取最大值,如果只有一个参数且是数组,则计算这个数组内的值。", + example: "MAX(num1, num2, ...numN)", params: [ { - type: '...number', - name: 'num', - description: '数值' + type: "...number", + name: "num", + description: "数值" } ], returns: { - type: 'number', - description: '所有传入值中最大的那个' + type: "number", + description: "所有传入值中最大的那个" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'MIN', - description: '获取最小值,如果只有一个参数且是数组,则计算这个数组内的值。', - example: 'MIN(num1, num2, ...numN)', + name: "MIN", + description: "获取最小值,如果只有一个参数且是数组,则计算这个数组内的值。", + example: "MIN(num1, num2, ...numN)", params: [ { - type: '...number', - name: 'num', - description: '数值' + type: "...number", + name: "num", + description: "数值" } ], returns: { - type: 'number', - description: '所有传入值中最小的那个' + type: "number", + description: "所有传入值中最小的那个" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'SUM', - description: '求和,如果只有一个参数且是数组,则计算这个数组内的值。', - example: 'SUM(num1, num2, ...numN)', + name: "SUM", + description: "求和,如果只有一个参数且是数组,则计算这个数组内的值。", + example: "SUM(num1, num2, ...numN)", params: [ { - type: '...number', - name: 'num', - description: '数值' + type: "...number", + name: "num", + description: "数值" } ], returns: { - type: 'number', - description: '所有传入数值的总和' + type: "number", + description: "所有传入数值的总和" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'INT', - description: '将数值向下取整为最接近的整数。', - example: 'INT(num)', + name: "INT", + description: "将数值向下取整为最接近的整数。", + example: "INT(num)", params: [ { - type: 'number', - name: 'num', - description: '数值' + type: "number", + name: "num", + description: "数值" } ], returns: { - type: 'number', - description: '数值对应的整形' + type: "number", + description: "数值对应的整形" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'MOD', - description: '返回两数相除的余数,参数 number 是被除数,divisor 是除数。', - example: 'MOD(num, divisor)', + name: "MOD", + description: "返回两数相除的余数,参数 number 是被除数,divisor 是除数。", + example: "MOD(num, divisor)", params: [ { - type: 'number', - name: 'num', - description: '被除数' + type: "number", + name: "num", + description: "被除数" }, { - type: 'number', - name: 'divisor', - description: '除数' + type: "number", + name: "divisor", + description: "除数" } ], returns: { - type: 'number', - description: '两数相除的余数' + type: "number", + description: "两数相除的余数" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'PI', - description: '圆周率 3.1415...。', - example: 'PI()', + name: "PI", + description: "圆周率 3.1415...。", + example: "PI()", params: [], returns: { - type: 'number', - description: '圆周率数值' + type: "number", + description: "圆周率数值" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'ROUND', - description: '将数字四舍五入到指定的位数,可以设置小数位。', - example: 'ROUND(num[, numDigits = 2])', + name: "ROUND", + description: "将数字四舍五入到指定的位数,可以设置小数位。", + example: "ROUND(num[, numDigits = 2])", params: [ { - type: 'number', - name: 'num', - description: '要处理的数字' + type: "number", + name: "num", + description: "要处理的数字" }, { - type: 'number', - name: 'numDigits', - description: '小数位数,默认为2' + type: "number", + name: "numDigits", + description: "小数位数,默认为2" } ], returns: { - type: 'number', - description: '传入数值四舍五入后的结果' + type: "number", + description: "传入数值四舍五入后的结果" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'FLOOR', - description: '将数字向下取整到指定的位数,可以设置小数位。', - example: 'FLOOR(num[, numDigits=2])', + name: "FLOOR", + description: "将数字向下取整到指定的位数,可以设置小数位。", + example: "FLOOR(num[, numDigits=2])", params: [ { - type: 'number', - name: 'num', - description: '要处理的数字' + type: "number", + name: "num", + description: "要处理的数字" }, { - type: 'number', - name: 'numDigits', - description: '小数位数,默认为2' + type: "number", + name: "numDigits", + description: "小数位数,默认为2" } ], returns: { - type: 'number', - description: '传入数值向下取整后的结果' + type: "number", + description: "传入数值向下取整后的结果" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'CEIL', - description: '将数字向上取整到指定的位数,可以设置小数位。', - example: 'CEIL(num[, numDigits=2])', + name: "CEIL", + description: "将数字向上取整到指定的位数,可以设置小数位。", + example: "CEIL(num[, numDigits=2])", params: [ { - type: 'number', - name: 'num', - description: '要处理的数字' + type: "number", + name: "num", + description: "要处理的数字" }, { - type: 'number', - name: 'numDigits', - description: '小数位数,默认为2' + type: "number", + name: "numDigits", + description: "小数位数,默认为2" } ], returns: { - type: 'number', - description: '传入数值向上取整后的结果' + type: "number", + description: "传入数值向上取整后的结果" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'SQRT', - description: '开平方,参数 number 为非负数', - example: 'SQRT(num)', + name: "SQRT", + description: "开平方,参数 number 为非负数", + example: "SQRT(num)", params: [ { - type: 'number', - name: 'num', - description: '要处理的数字' + type: "number", + name: "num", + description: "要处理的数字" } ], returns: { - type: 'number', - description: '开平方的结果' + type: "number", + description: "开平方的结果" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'AVG', - description: - '返回所有参数的平均值,如果只有一个参数且是数组,则计算这个数组内的值。', - example: 'AVG(num1, num2, ...numN)', + name: "AVG", + description: "返回所有参数的平均值,如果只有一个参数且是数组,则计算这个数组内的值。", + example: "AVG(num1, num2, ...numN)", params: [ { - type: '...number', - name: 'num', - description: '要处理的数字' + type: "...number", + name: "num", + description: "要处理的数字" } ], returns: { - type: 'number', - description: '所有数值的平均值' + type: "number", + description: "所有数值的平均值" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'DEVSQ', - description: - '返回数据点与数据均值点之差(数据偏差)的平方和,如果只有一个参数且是数组,则计算这个数组内的值。', - example: 'DEVSQ(num1, num2, ...numN)', + name: "DEVSQ", + description: "返回数据点与数据均值点之差(数据偏差)的平方和,如果只有一个参数且是数组,则计算这个数组内的值。", + example: "DEVSQ(num1, num2, ...numN)", params: [ { - type: '...number', - name: 'num', - description: '要处理的数字' + type: "...number", + name: "num", + description: "要处理的数字" } ], returns: { - type: 'number', - description: '所有数值的平均值' + type: "number", + description: "所有数值的平均值" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'AVEDEV', - description: '数据点到其算术平均值的绝对偏差的平均值。', - example: 'AVEDEV(num1, num2, ...numN)', + name: "AVEDEV", + description: "数据点到其算术平均值的绝对偏差的平均值。", + example: "AVEDEV(num1, num2, ...numN)", params: [ { - type: '...number', - name: 'num', - description: '要处理的数字' + type: "...number", + name: "num", + description: "要处理的数字" } ], returns: { - type: 'number', - description: '所有数值的平均值' + type: "number", + description: "所有数值的平均值" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'HARMEAN', - description: - '数据点的调和平均值,如果只有一个参数且是数组,则计算这个数组内的值。', - example: 'HARMEAN(num1, num2, ...numN)', + name: "HARMEAN", + description: "数据点的调和平均值,如果只有一个参数且是数组,则计算这个数组内的值。", + example: "HARMEAN(num1, num2, ...numN)", params: [ { - type: '...number', - name: 'num', - description: '要处理的数字' + type: "...number", + name: "num", + description: "要处理的数字" } ], returns: { - type: 'number', - description: '所有数值的平均值' + type: "number", + description: "所有数值的平均值" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'LARGE', - description: '数据集中第 k 个最大值。', - example: 'LARGE(array, k)', + name: "LARGE", + description: "数据集中第 k 个最大值。", + example: "LARGE(array, k)", params: [ { - type: 'array', - name: 'nums', - description: '要处理的数字' + type: "array", + name: "nums", + description: "要处理的数字" }, { - type: 'number', - name: 'k', - description: '第几大' + type: "number", + name: "k", + description: "第几大" } ], returns: { - type: 'number', - description: '所有数值的平均值' + type: "number", + description: "所有数值的平均值" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'UPPERMONEY', - description: '将数值转为中文大写金额。', - example: 'UPPERMONEY(num)', + name: "UPPERMONEY", + description: "将数值转为中文大写金额。", + example: "UPPERMONEY(num)", params: [ { - type: 'number', - name: 'num', - description: '要处理的数字' + type: "number", + name: "num", + description: "要处理的数字" } ], returns: { - type: 'string', - description: '数值中文大写字符' + type: "string", + description: "数值中文大写字符" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'RAND', - description: - '返回大于等于 0 且小于 1 的均匀分布随机实数。每一次触发计算都会变化。\n\n示例:`RAND()*100`,\n\n返回 0-100 之间的随机数。', - example: 'RAND()', + name: "RAND", + description: "返回大于等于 0 且小于 1 的均匀分布随机实数。每一次触发计算都会变化。\n\n示例:`RAND()*100`,\n\n返回 0-100 之间的随机数。", + example: "RAND()", params: [], returns: { - type: 'number', - description: '随机数' + type: "number", + description: "随机数" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'LAST', - description: '取数据最后一个。', - example: 'LAST(array)', + name: "LAST", + description: "取数据最后一个。", + example: "LAST(array)", params: [ { - type: '...number', - name: 'arr', - description: '要处理的数组' + type: "...number", + name: "arr", + description: "要处理的数组" } ], returns: { - type: 'any', - description: '最后一个值' + type: "any", + description: "最后一个值" }, - namespace: '数学函数' + namespace: "数学函数" }, { - name: 'LEFT', - description: '返回传入文本左侧的指定长度字符串。', - example: 'LEFT(text, len)', + name: "LEFT", + description: "返回传入文本左侧的指定长度字符串。", + example: "LEFT(text, len)", params: [ { - type: 'string', - name: 'text', - description: '要处理的文本' + type: "string", + name: "text", + description: "要处理的文本" }, { - type: 'number', - name: 'len', - description: '要处理的长度' + type: "number", + name: "len", + description: "要处理的长度" } ], returns: { - type: 'string', - description: '对应字符串' + type: "string", + description: "对应字符串" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'RIGHT', - description: '返回传入文本右侧的指定长度字符串。', - example: 'RIGHT(text, len)', + name: "RIGHT", + description: "返回传入文本右侧的指定长度字符串。", + example: "RIGHT(text, len)", params: [ { - type: 'string', - name: 'text', - description: '要处理的文本' + type: "string", + name: "text", + description: "要处理的文本" }, { - type: 'number', - name: 'len', - description: '要处理的长度' + type: "number", + name: "len", + description: "要处理的长度" } ], returns: { - type: 'string', - description: '对应字符串' + type: "string", + description: "对应字符串" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'LEN', - description: '计算文本的长度。', - example: 'LEN(text)', + name: "LEN", + description: "计算文本的长度。", + example: "LEN(text)", params: [ { - type: 'string', - name: 'text', - description: '要处理的文本' + type: "string", + name: "text", + description: "要处理的文本" } ], returns: { - type: 'number', - description: '长度' + type: "number", + description: "长度" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'LENGTH', - description: '计算文本集合中所有文本的长度。', - example: 'LENGTH(textArr)', + name: "LENGTH", + description: "计算文本集合中所有文本的长度。", + example: "LENGTH(textArr)", params: [ { - type: 'Array', - name: 'textArr', - description: '要处理的文本集合' + type: "Array", + name: "textArr", + description: "要处理的文本集合" } ], returns: { - type: 'Array', - description: '长度集合' + type: "Array", + description: "长度集合" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'ISEMPTY', - description: '判断文本是否为空。', - example: 'ISEMPTY(text)', + name: "ISEMPTY", + description: "判断文本是否为空。", + example: "ISEMPTY(text)", params: [ { - type: 'string', - name: 'text', - description: '要处理的文本' + type: "string", + name: "text", + description: "要处理的文本" } ], returns: { - type: 'boolean', - description: '判断结果' + type: "boolean", + description: "判断结果" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'CONCATENATE', - description: '将多个传入值连接成文本。', - example: 'CONCATENATE(text1, text2, ...textN)', + name: "CONCATENATE", + description: "将多个传入值连接成文本。", + example: "CONCATENATE(text1, text2, ...textN)", params: [ { - type: '...string', - name: 'text', - description: '文本集合' + type: "...string", + name: "text", + description: "文本集合" } ], returns: { - type: 'string', - description: '连接后的文本' + type: "string", + description: "连接后的文本" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'CHAR', - description: - '返回计算机字符集的数字代码所对应的字符。\n\n示例:`CHAR(97)` 等价于 "a"。', - example: 'CHAR(code)', + name: "CHAR", + description: "返回计算机字符集的数字代码所对应的字符。\n\n示例:`CHAR(97)` 等价于 \"a\"。", + example: "CHAR(code)", params: [ { - type: 'number', - name: 'code', - description: '编码值' + type: "number", + name: "code", + description: "编码值" } ], returns: { - type: 'string', - description: '指定位置的字符' + type: "string", + description: "指定位置的字符" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'LOWER', - description: '将传入文本转成小写。', - example: 'LOWER(text)', + name: "LOWER", + description: "将传入文本转成小写。", + example: "LOWER(text)", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" } ], returns: { - type: 'string', - description: '结果文本' + type: "string", + description: "结果文本" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'UPPER', - description: '将传入文本转成大写。', - example: 'UPPER(text)', + name: "UPPER", + description: "将传入文本转成大写。", + example: "UPPER(text)", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" } ], returns: { - type: 'string', - description: '结果文本' + type: "string", + description: "结果文本" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'UPPERFIRST', - description: '将传入文本首字母转成大写。', - example: 'UPPERFIRST(text)', + name: "UPPERFIRST", + description: "将传入文本首字母转成大写。", + example: "UPPERFIRST(text)", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" } ], returns: { - type: 'string', - description: '结果文本' + type: "string", + description: "结果文本" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'PADSTART', - description: - '向前补齐文本长度。\n\n示例 `PADSTART("6", 2, "0")`,\n\n返回 `06`。', - example: 'PADSTART(text)', + name: "PADSTART", + description: "向前补齐文本长度。\n\n示例 `PADSTART(\"6\", 2, \"0\")`,\n\n返回 `06`。", + example: "PADSTART(text)", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" }, { - type: 'number', - name: 'num', - description: '目标长度' + type: "number", + name: "num", + description: "目标长度" }, { - type: 'string', - name: 'pad', - description: '用于补齐的文本' + type: "string", + name: "pad", + description: "用于补齐的文本" } ], returns: { - type: 'string', - description: '结果文本' + type: "string", + description: "结果文本" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'CAPITALIZE', - description: - '将文本转成标题。\n\n示例 `CAPITALIZE("star")`,\n\n返回 `Star`。', - example: 'CAPITALIZE(text)', + name: "CAPITALIZE", + description: "将文本转成标题。\n\n示例 `CAPITALIZE(\"star\")`,\n\n返回 `Star`。", + example: "CAPITALIZE(text)", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" } ], returns: { - type: 'string', - description: '结果文本' + type: "string", + description: "结果文本" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'ESCAPE', - description: - '对文本进行 HTML 转义。\n\n示例 `ESCAPE("&")`,\n\n返回 `<start>&`。', - example: 'ESCAPE(text)', + name: "ESCAPE", + description: "对文本进行 HTML 转义。\n\n示例 `ESCAPE(\"&\")`,\n\n返回 `<start>&`。", + example: "ESCAPE(text)", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" } ], returns: { - type: 'string', - description: '结果文本' + type: "string", + description: "结果文本" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'TRUNCATE', - description: - '对文本长度进行截断。\n\n示例 `TRUNCATE("amis.baidu.com", 6)`,\n\n返回 `amis...`。', - example: 'TRUNCATE(text, 6)', + name: "TRUNCATE", + description: "对文本长度进行截断。\n\n示例 `TRUNCATE(\"amis.baidu.com\", 6)`,\n\n返回 `amis...`。", + example: "TRUNCATE(text, 6)", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" }, { - type: 'number', - name: 'text', - description: '最长长度' + type: "number", + name: "text", + description: "最长长度" } ], returns: { - type: 'string', - description: '结果文本' + type: "string", + description: "结果文本" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'BEFORELAST', - description: '取在某个分隔符之前的所有字符串。', + name: "BEFORELAST", + description: "取在某个分隔符之前的所有字符串。", example: "BEFORELAST(text, '.')", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" }, { - type: 'string', - name: 'delimiter', - description: '结束文本' + type: "string", + name: "delimiter", + description: "结束文本" } ], returns: { - type: 'string', - description: '判断结果' + type: "string", + description: "判断结果" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'SPLIT', - description: - '将文本根据指定片段分割成数组。\n\n示例:`SPLIT("a,b,c", ",")`,\n\n返回 `["a", "b", "c"]`。', + name: "SPLIT", + description: "将文本根据指定片段分割成数组。\n\n示例:`SPLIT(\"a,b,c\", \",\")`,\n\n返回 `[\"a\", \"b\", \"c\"]`。", example: "SPLIT(text, ',')", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" }, { - type: 'string', - name: 'delimiter', - description: '文本片段' + type: "string", + name: "delimiter", + description: "文本片段" } ], returns: { - type: 'Array', - description: '文本集' + type: "Array", + description: "文本集" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'TRIM', - description: '将文本去除前后空格。', - example: 'TRIM(text)', + name: "TRIM", + description: "将文本去除前后空格。", + example: "TRIM(text)", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" } ], returns: { - type: 'string', - description: '处理后的文本' + type: "string", + description: "处理后的文本" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'STRIPTAG', - description: - '去除文本中的 HTML 标签。\n\n示例:`STRIPTAG("amis")`,\n\n返回:`amis`。', - example: 'STRIPTAG(text)', + name: "STRIPTAG", + description: "去除文本中的 HTML 标签。\n\n示例:`STRIPTAG(\"amis\")`,\n\n返回:`amis`。", + example: "STRIPTAG(text)", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" } ], returns: { - type: 'string', - description: '处理后的文本' + type: "string", + description: "处理后的文本" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'LINEBREAK', - description: - '将字符串中的换行转成 HTML `
`,用于简单换行的场景。\n\n示例:`LINEBREAK("\\n")`,\n\n返回:`
`。', - example: 'LINEBREAK(text)', + name: "LINEBREAK", + description: "将字符串中的换行转成 HTML `
`,用于简单换行的场景。\n\n示例:`LINEBREAK(\"\\n\")`,\n\n返回:`
`。", + example: "LINEBREAK(text)", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" } ], returns: { - type: 'string', - description: '处理后的文本' + type: "string", + description: "处理后的文本" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'STARTSWITH', - description: - '判断字符串(text)是否以特定字符串(startString)开始,是则返回 true,否则返回 false。', + name: "STARTSWITH", + description: "判断字符串(text)是否以特定字符串(startString)开始,是则返回 true,否则返回 false。", example: "STARTSWITH(text, '片段')", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" }, { - type: 'string', - name: 'startString', - description: '起始文本' + type: "string", + name: "startString", + description: "起始文本" } ], returns: { - type: 'string', - description: '判断结果' + type: "string", + description: "判断结果" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'ENDSWITH', - description: - '判断字符串(text)是否以特定字符串(endString)结束,是则返回 true,否则返回 false。', + name: "ENDSWITH", + description: "判断字符串(text)是否以特定字符串(endString)结束,是则返回 true,否则返回 false。", example: "ENDSWITH(text, '片段')", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" }, { - type: 'string', - name: 'endString', - description: '结束文本' + type: "string", + name: "endString", + description: "结束文本" } ], returns: { - type: 'string', - description: '判断结果' + type: "string", + description: "判断结果" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'CONTAINS', - description: - '判断参数 1 中的文本是否包含参数 2 中的文本,是则返回 true,否则返回 false。', - example: 'CONTAINS(text, searchText)', + name: "CONTAINS", + description: "判断参数 1 中的文本是否包含参数 2 中的文本,是则返回 true,否则返回 false。", + example: "CONTAINS(text, searchText)", params: [ { - type: 'string', - name: 'text', - description: '文本' + type: "string", + name: "text", + description: "文本" }, { - type: 'string', - name: 'searchText', - description: '搜索文本' + type: "string", + name: "searchText", + description: "搜索文本" } ], returns: { - type: 'string', - description: '判断结果' + type: "string", + description: "判断结果" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'REPLACE', - description: '对文本进行全量替换。', - example: 'REPLACE(text, search, replace)', + name: "REPLACE", + description: "对文本进行全量替换。", + example: "REPLACE(text, search, replace)", params: [ { - type: 'string', - name: 'text', - description: '要处理的文本' + type: "string", + name: "text", + description: "要处理的文本" }, { - type: 'string', - name: 'search', - description: '要被替换的文本' + type: "string", + name: "search", + description: "要被替换的文本" }, { - type: 'string', - name: 'replace', - description: '要替换的文本' + type: "string", + name: "replace", + description: "要替换的文本" } ], returns: { - type: 'string', - description: '处理结果' + type: "string", + description: "处理结果" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'SEARCH', - description: '对文本进行搜索,返回命中的位置。', - example: 'SEARCH(text, search, 0)', + name: "SEARCH", + description: "对文本进行搜索,返回命中的位置。", + example: "SEARCH(text, search, 0)", params: [ { - type: 'string', - name: 'text', - description: '要处理的文本' + type: "string", + name: "text", + description: "要处理的文本" }, { - type: 'string', - name: 'search', - description: '用来搜索的文本' + type: "string", + name: "search", + description: "用来搜索的文本" }, { - type: 'number', - name: 'start', - description: '起始位置' + type: "number", + name: "start", + description: "起始位置" } ], returns: { - type: 'number', - description: '命中的位置' + type: "number", + description: "命中的位置" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'MID', - description: '返回文本字符串中从指定位置开始的特定数目的字符。', - example: 'MID(text, from, len)', + name: "MID", + description: "返回文本字符串中从指定位置开始的特定数目的字符。", + example: "MID(text, from, len)", params: [ { - type: 'string', - name: 'text', - description: '要处理的文本' + type: "string", + name: "text", + description: "要处理的文本" }, { - type: 'number', - name: 'from', - description: '起始位置' + type: "number", + name: "from", + description: "起始位置" }, { - type: 'number', - name: 'len', - description: '处理长度' + type: "number", + name: "len", + description: "处理长度" } ], returns: { - type: 'number', - description: '命中的位置' + type: "number", + description: "命中的位置" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'BASENAME', - description: - '返回路径中的文件名。\n\n示例:`/home/amis/a.json`,\n\n返回:a.json`。', - example: 'BASENAME(text)', + name: "BASENAME", + description: "返回路径中的文件名。\n\n示例:`/home/amis/a.json`,\n\n返回:a.json`。", + example: "BASENAME(text)", params: [ { - type: 'string', - name: 'text', - description: '要处理的文本' + type: "string", + name: "text", + description: "要处理的文本" } ], returns: { - type: 'string', - description: '文件名' + type: "string", + description: "文件名" }, - namespace: '文本函数' + namespace: "文本函数" }, { - name: 'DATE', - description: - '创建日期对象,可以通过特定格式的字符串,或者数值。\n\n需要注意的是,其中月份的数值是从0开始的,\n即如果是12月份,你应该传入数值11。', + name: "DATE", + description: "创建日期对象,可以通过特定格式的字符串,或者数值。\n\n需要注意的是,其中月份的数值是从0开始的,\n即如果是12月份,你应该传入数值11。", example: "DATE('2021-12-06 08:20:00')", params: [], returns: { - type: 'Date', - description: '日期对象' + type: "Date", + description: "日期对象" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'TIMESTAMP', - description: '返回时间的时间戳。', - example: 'TIMESTAMP(date[, format = "X"])', + name: "TIMESTAMP", + description: "返回时间的时间戳。", + example: "TIMESTAMP(date[, format = \"X\"])", params: [ { - type: 'date', - name: 'date', - description: '日期对象' + type: "date", + name: "date", + description: "日期对象" }, { - type: 'string', - name: 'format', + type: "string", + name: "format", description: "时间戳格式,带毫秒传入 'x'。默认为 'X' 不带毫秒的。" } ], returns: { - type: 'number', - description: '时间戳' + type: "number", + description: "时间戳" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'TODAY', - description: '返回今天的日期。', - example: 'TODAY()', + name: "TODAY", + description: "返回今天的日期。", + example: "TODAY()", params: [], returns: { - type: 'number', - description: '日期' + type: "number", + description: "日期" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'NOW', - description: '返回现在的日期', - example: 'NOW()', + name: "NOW", + description: "返回现在的日期", + example: "NOW()", params: [], returns: { - type: 'number', - description: '日期' + type: "number", + description: "日期" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'WEEKDAY', + name: "WEEKDAY", description: "获取日期的星期几。\n\n示例\n\nWEEKDAY('2023-02-27') 得到 1。", - example: 'WEEKDAY(date)', + example: "WEEKDAY(date)", params: [ { - type: 'any', - name: 'date', - description: '日期' + type: "any", + name: "date", + description: "日期" }, { - type: 'number', - name: 'type', - description: - '星期定义类型,默认为1,1表示0至6代表星期一到星期日,2表示1至7代表星期一到星期日' + type: "number", + name: "type", + description: "星期定义类型,默认为1,1表示0至6代表星期一到星期日,2表示1至7代表星期一到星期日" } ], returns: { - type: 'number', - description: '星期几的数字标识' + type: "number", + description: "星期几的数字标识" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'WEEK', - description: - "获取年份的星期,即第几周。\n\n示例\n\nWEEK('2023-03-05') 得到 10。", - example: 'WEEK(date)', + name: "WEEK", + description: "获取年份的星期,即第几周。\n\n示例\n\nWEEK('2023-03-05') 得到 10。", + example: "WEEK(date)", params: [ { - type: 'any', - name: 'date', - description: '日期' + type: "any", + name: "date", + description: "日期" }, { - type: 'boolean', - name: 'isISO', - description: '是否ISO星期' + type: "boolean", + name: "isISO", + description: "是否ISO星期" } ], returns: { - type: 'number', - description: '星期几的数字标识' + type: "number", + description: "星期几的数字标识" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'DATETOSTR', - description: - "对日期、日期字符串、时间戳进行格式化。\n\n示例\n\nDATETOSTR('12/25/2022', 'YYYY-MM-DD') 得到 '2022.12.25',\nDATETOSTR(1676563200, 'YYYY.MM.DD') 得到 '2023.02.17',\nDATETOSTR(1676563200000, 'YYYY.MM.DD hh:mm:ss') 得到 '2023.02.17 12:00:00',\nDATETOSTR(DATE('2021-12-21'), 'YYYY.MM.DD hh:mm:ss') 得到 '2021.12.21 08:00:00'。", + name: "DATETOSTR", + description: "对日期、日期字符串、时间戳进行格式化。\n\n示例\n\nDATETOSTR('12/25/2022', 'YYYY-MM-DD') 得到 '2022.12.25',\nDATETOSTR(1676563200, 'YYYY.MM.DD') 得到 '2023.02.17',\nDATETOSTR(1676563200000, 'YYYY.MM.DD hh:mm:ss') 得到 '2023.02.17 12:00:00',\nDATETOSTR(DATE('2021-12-21'), 'YYYY.MM.DD hh:mm:ss') 得到 '2021.12.21 08:00:00'。", example: "DATETOSTR(date, 'YYYY-MM-DD')", params: [ { - type: 'any', - name: 'date', - description: '日期对象、日期字符串、时间戳' + type: "any", + name: "date", + description: "日期对象、日期字符串、时间戳" }, { - type: 'string', - name: 'format', - description: '日期格式,默认为 "YYYY-MM-DD HH:mm:ss"' + type: "string", + name: "format", + description: "日期格式,默认为 \"YYYY-MM-DD HH:mm:ss\"" } ], returns: { - type: 'string', - description: '日期字符串' + type: "string", + description: "日期字符串" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'DATERANGESPLIT', - description: - "获取日期范围字符串中的开始时间、结束时间。\n\n示例:\n\nDATERANGESPLIT('1676563200, 1676735999') 得到 [1676563200, 1676735999],\nDATERANGESPLIT('1676563200, 1676735999', undefined , 'YYYY.MM.DD hh:mm:ss') 得到 [2023.02.17 12:00:00, 2023.02.18 11:59:59],\nDATERANGESPLIT('1676563200, 1676735999', 0 , 'YYYY.MM.DD hh:mm:ss') 得到 '2023.02.17 12:00:00',\nDATERANGESPLIT('1676563200, 1676735999', 'start' , 'YYYY.MM.DD hh:mm:ss') 得到 '2023.02.17 12:00:00',\nDATERANGESPLIT('1676563200, 1676735999', 1 , 'YYYY.MM.DD hh:mm:ss') 得到 '2023.02.18 11:59:59',\nDATERANGESPLIT('1676563200, 1676735999', 'end' , 'YYYY.MM.DD hh:mm:ss') 得到 '2023.02.18 11:59:59'。", + name: "DATERANGESPLIT", + description: "获取日期范围字符串中的开始时间、结束时间。\n\n示例:\n\nDATERANGESPLIT('1676563200, 1676735999') 得到 [1676563200, 1676735999],\nDATERANGESPLIT('1676563200, 1676735999', undefined , 'YYYY.MM.DD hh:mm:ss') 得到 [2023.02.17 12:00:00, 2023.02.18 11:59:59],\nDATERANGESPLIT('1676563200, 1676735999', 0 , 'YYYY.MM.DD hh:mm:ss') 得到 '2023.02.17 12:00:00',\nDATERANGESPLIT('1676563200, 1676735999', 'start' , 'YYYY.MM.DD hh:mm:ss') 得到 '2023.02.17 12:00:00',\nDATERANGESPLIT('1676563200, 1676735999', 1 , 'YYYY.MM.DD hh:mm:ss') 得到 '2023.02.18 11:59:59',\nDATERANGESPLIT('1676563200, 1676735999', 'end' , 'YYYY.MM.DD hh:mm:ss') 得到 '2023.02.18 11:59:59'。", example: "DATERANGESPLIT(date, 'YYYY-MM-DD')", params: [ { - type: 'string', - name: 'date', - description: '日期范围字符串' + type: "string", + name: "date", + description: "日期范围字符串" }, { - type: 'string', - name: 'key', - description: - "取值标识,0或'start'表示获取开始时间,1或'end'表示获取结束时间" + type: "string", + name: "key", + description: "取值标识,0或'start'表示获取开始时间,1或'end'表示获取结束时间" }, { - type: 'string', - name: 'format', - description: '日期格式,可选' + type: "string", + name: "format", + description: "日期格式,可选" }, { - type: 'string', - name: 'delimiter', + type: "string", + name: "delimiter", description: "分隔符,可选,默认为','" } ], returns: { - type: 'string', - description: '日期字符串' + type: "string", + description: "日期字符串" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'STARTOF', - description: '返回日期的指定范围的开端。', - example: 'STARTOF(date[unit = "day"])', + name: "STARTOF", + description: "返回日期的指定范围的开端。", + example: "STARTOF(date[unit = \"day\"])", params: [ { - type: 'date', - name: 'date', - description: '日期对象' + type: "date", + name: "date", + description: "日期对象" }, { - type: 'string', - name: 'unit', + type: "string", + name: "unit", description: "比如可以传入 'day'、'month'、'year' 或者 `week` 等等" }, { - type: 'string', - name: 'format', - description: '日期格式,可选' + type: "string", + name: "format", + description: "日期格式,可选" } ], returns: { - type: 'date', - description: '新的日期对象' + type: "date", + description: "新的日期对象" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'ENDOF', - description: '返回日期的指定范围的末尾。', - example: 'ENDOF(date[unit = "day"])', + name: "ENDOF", + description: "返回日期的指定范围的末尾。", + example: "ENDOF(date[unit = \"day\"])", params: [ { - type: 'date', - name: 'date', - description: '日期对象' + type: "date", + name: "date", + description: "日期对象" }, { - type: 'string', - name: 'unit', + type: "string", + name: "unit", description: "比如可以传入 'day'、'month'、'year' 或者 `week` 等等" }, { - type: 'string', - name: 'format', - description: '日期格式,可选' + type: "string", + name: "format", + description: "日期格式,可选" } ], returns: { - type: 'date', - description: '新的日期对象' + type: "date", + description: "新的日期对象" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'YEAR', - description: '返回日期的年份。', - example: 'YEAR(date)', + name: "YEAR", + description: "返回日期的年份。", + example: "YEAR(date)", params: [ { - type: 'date', - name: 'date', - description: '日期对象' + type: "date", + name: "date", + description: "日期对象" } ], returns: { - type: 'number', - description: '数值' + type: "number", + description: "数值" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'MONTH', - description: '返回日期的月份,这里就是自然月份。', - example: 'MONTH(date)', + name: "MONTH", + description: "返回日期的月份,这里就是自然月份。", + example: "MONTH(date)", params: [ { - type: 'date', - name: 'date', - description: '日期对象' + type: "date", + name: "date", + description: "日期对象" } ], returns: { - type: 'number', - description: '数值' + type: "number", + description: "数值" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'DAY', - description: '返回日期的天。', - example: 'DAY(date)', + name: "DAY", + description: "返回日期的天。", + example: "DAY(date)", params: [ { - type: 'date', - name: 'date', - description: '日期对象' + type: "date", + name: "date", + description: "日期对象" } ], returns: { - type: 'number', - description: '数值' + type: "number", + description: "数值" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'HOUR', - description: '返回日期的小时。', - example: 'HOUR(date)', + name: "HOUR", + description: "返回日期的小时。", + example: "HOUR(date)", params: [ { - type: 'date', - name: 'date', - description: '日期对象' + type: "date", + name: "date", + description: "日期对象" } ], returns: { - type: 'number', - description: '数值' + type: "number", + description: "数值" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'MINUTE', - description: '返回日期的分。', - example: 'MINUTE(date)', + name: "MINUTE", + description: "返回日期的分。", + example: "MINUTE(date)", params: [ { - type: 'date', - name: 'date', - description: '日期对象' + type: "date", + name: "date", + description: "日期对象" } ], returns: { - type: 'number', - description: '数值' + type: "number", + description: "数值" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'SECOND', - description: '返回日期的秒。', - example: 'SECOND(date)', + name: "SECOND", + description: "返回日期的秒。", + example: "SECOND(date)", params: [ { - type: 'date', - name: 'date', - description: '日期对象' + type: "date", + name: "date", + description: "日期对象" } ], returns: { - type: 'number', - description: '数值' + type: "number", + description: "数值" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'YEARS', - description: '返回两个日期相差多少年。', - example: 'YEARS(endDate, startDate)', + name: "YEARS", + description: "返回两个日期相差多少年。", + example: "YEARS(endDate, startDate)", params: [ { - type: 'date', - name: 'endDate', - description: '日期对象' + type: "date", + name: "endDate", + description: "日期对象" }, { - type: 'date', - name: 'startDate', - description: '日期对象' + type: "date", + name: "startDate", + description: "日期对象" } ], returns: { - type: 'number', - description: '数值' + type: "number", + description: "数值" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'MINUTES', - description: '返回两个日期相差多少分钟。', - example: 'MINUTES(endDate, startDate)', + name: "MINUTES", + description: "返回两个日期相差多少分钟。", + example: "MINUTES(endDate, startDate)", params: [ { - type: 'date', - name: 'endDate', - description: '日期对象' + type: "date", + name: "endDate", + description: "日期对象" }, { - type: 'date', - name: 'startDate', - description: '日期对象' + type: "date", + name: "startDate", + description: "日期对象" } ], returns: { - type: 'number', - description: '数值' + type: "number", + description: "数值" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'DAYS', - description: '返回两个日期相差多少天。', - example: 'DAYS(endDate, startDate)', + name: "DAYS", + description: "返回两个日期相差多少天。", + example: "DAYS(endDate, startDate)", params: [ { - type: 'date', - name: 'endDate', - description: '日期对象' + type: "date", + name: "endDate", + description: "日期对象" }, { - type: 'date', - name: 'startDate', - description: '日期对象' + type: "date", + name: "startDate", + description: "日期对象" } ], returns: { - type: 'number', - description: '数值' + type: "number", + description: "数值" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'HOURS', - description: '返回两个日期相差多少小时。', - example: 'HOURS(endDate, startDate)', + name: "HOURS", + description: "返回两个日期相差多少小时。", + example: "HOURS(endDate, startDate)", params: [ { - type: 'date', - name: 'endDate', - description: '日期对象' + type: "date", + name: "endDate", + description: "日期对象" }, { - type: 'date', - name: 'startDate', - description: '日期对象' + type: "date", + name: "startDate", + description: "日期对象" } ], returns: { - type: 'number', - description: '数值' + type: "number", + description: "数值" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'DATEMODIFY', - description: - "修改日期,对日期进行加减天、月份、年等操作。\n\n示例:\n\nDATEMODIFY(A, -2, 'month'),\n\n对日期 A 进行往前减2月的操作。", + name: "DATEMODIFY", + description: "修改日期,对日期进行加减天、月份、年等操作。\n\n示例:\n\nDATEMODIFY(A, -2, 'month'),\n\n对日期 A 进行往前减2月的操作。", example: "DATEMODIFY(date, 2, 'days')", params: [ { - type: 'date', - name: 'date', - description: '日期对象' + type: "date", + name: "date", + description: "日期对象" }, { - type: 'number', - name: 'num', - description: '数值' + type: "number", + name: "num", + description: "数值" }, { - type: 'string', - name: 'unit', - description: '单位:支持年、月、天等等' + type: "string", + name: "unit", + description: "单位:支持年、月、天等等" } ], returns: { - type: 'date', - description: '日期对象' + type: "date", + description: "日期对象" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'STRTODATE', - description: - "将字符日期转成日期对象,可以指定日期格式。\n\n示例:STRTODATE('2021/12/6', 'YYYY/MM/DD')", - example: 'STRTODATE(value[, format=""])', + name: "STRTODATE", + description: "将字符日期转成日期对象,可以指定日期格式。\n\n示例:STRTODATE('2021/12/6', 'YYYY/MM/DD')", + example: "STRTODATE(value[, format=\"\"])", params: [ { - type: 'string', - name: 'value', - description: '日期字符' + type: "string", + name: "value", + description: "日期字符" }, { - type: 'string', - name: 'format', - description: '日期格式' + type: "string", + name: "format", + description: "日期格式" } ], returns: { - type: 'date', - description: '日期对象' + type: "date", + description: "日期对象" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'ISBEFORE', - description: - '判断两个日期,是否第一个日期在第二个日期的前面,是则返回 true,否则返回 false。', - example: 'ISBEFORE(a, b)', + name: "ISBEFORE", + description: "判断两个日期,是否第一个日期在第二个日期的前面,是则返回 true,否则返回 false。", + example: "ISBEFORE(a, b)", params: [ { - type: 'date', - name: 'a', - description: '第一个日期' + type: "date", + name: "a", + description: "第一个日期" }, { - type: 'date', - name: 'b', - description: '第二个日期' + type: "date", + name: "b", + description: "第二个日期" }, { - type: 'string', - name: 'unit', + type: "string", + name: "unit", description: "单位,默认是 'day', 即之比较到天" } ], returns: { - type: 'boolean', - description: '判断结果' + type: "boolean", + description: "判断结果" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'ISAFTER', - description: - '判断两个日期,是否第一个日期在第二个日期的后面,是则返回 true,否则返回 false。', - example: 'ISAFTER(a, b)', + name: "ISAFTER", + description: "判断两个日期,是否第一个日期在第二个日期的后面,是则返回 true,否则返回 false。", + example: "ISAFTER(a, b)", params: [ { - type: 'date', - name: 'a', - description: '第一个日期' + type: "date", + name: "a", + description: "第一个日期" }, { - type: 'date', - name: 'b', - description: '第二个日期' + type: "date", + name: "b", + description: "第二个日期" }, { - type: 'string', - name: 'unit', + type: "string", + name: "unit", description: "单位,默认是 'day', 即之比较到天" } ], returns: { - type: 'boolean', - description: '判断结果' + type: "boolean", + description: "判断结果" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'BETWEENRANGE', - description: - "判断日期是否在指定范围内,是则返回 true,否则返回 false。\n\n示例:BETWEENRANGE('2021/12/6', ['2021/12/5','2021/12/7'])。", - example: 'BETWEENRANGE(date, [start, end])', + name: "BETWEENRANGE", + description: "判断日期是否在指定范围内,是则返回 true,否则返回 false。\n\n示例:BETWEENRANGE('2021/12/6', ['2021/12/5','2021/12/7'])。", + example: "BETWEENRANGE(date, [start, end])", params: [ { - type: 'any', - name: 'date', - description: '第一个日期' + type: "any", + name: "date", + description: "第一个日期" }, { - type: 'Array', - name: 'daterange', - description: '日期范围' + type: "Array", + name: "daterange", + description: "日期范围" }, { - type: 'string', - name: 'unit', + type: "string", + name: "unit", description: "单位,默认是 'day', 即之比较到天" }, { - type: 'string', - name: 'inclusivity', - description: - "包容性规则,默认为'[]'。[ 表示包含、( 表示排除,如果使用包容性参数,则必须传入两个指示符,如'()'表示左右范围都排除" + type: "string", + name: "inclusivity", + description: "包容性规则,默认为'[]'。[ 表示包含、( 表示排除,如果使用包容性参数,则必须传入两个指示符,如'()'表示左右范围都排除" } ], returns: { - type: 'boolean', - description: '判断结果' + type: "boolean", + description: "判断结果" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'ISSAMEORBEFORE', - description: - '判断两个日期,是否第一个日期在第二个日期的前面或者相等,是则返回 true,否则返回 false。', - example: 'ISSAMEORBEFORE(a, b)', + name: "ISSAMEORBEFORE", + description: "判断两个日期,是否第一个日期在第二个日期的前面或者相等,是则返回 true,否则返回 false。", + example: "ISSAMEORBEFORE(a, b)", params: [ { - type: 'date', - name: 'a', - description: '第一个日期' + type: "date", + name: "a", + description: "第一个日期" }, { - type: 'date', - name: 'b', - description: '第二个日期' + type: "date", + name: "b", + description: "第二个日期" }, { - type: 'string', - name: 'unit', + type: "string", + name: "unit", description: "单位,默认是 'day', 即之比较到天" } ], returns: { - type: 'boolean', - description: '判断结果' + type: "boolean", + description: "判断结果" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'ISSAMEORAFTER', - description: - '判断两个日期,是否第一个日期在第二个日期的后面或者相等,是则返回 true,否则返回 false。', - example: 'ISSAMEORAFTER(a, b)', + name: "ISSAMEORAFTER", + description: "判断两个日期,是否第一个日期在第二个日期的后面或者相等,是则返回 true,否则返回 false。", + example: "ISSAMEORAFTER(a, b)", params: [ { - type: 'date', - name: 'a', - description: '第一个日期' + type: "date", + name: "a", + description: "第一个日期" }, { - type: 'date', - name: 'b', - description: '第二个日期' + type: "date", + name: "b", + description: "第二个日期" }, { - type: 'string', - name: 'unit', + type: "string", + name: "unit", description: "单位,默认是 'day', 即之比较到天" } ], returns: { - type: 'boolean', - description: '判断结果' + type: "boolean", + description: "判断结果" }, - namespace: '日期函数' + namespace: "日期函数" }, { - name: 'COUNT', - description: '返回数组的长度。', - example: 'COUNT(arr)', + name: "COUNT", + description: "返回数组的长度。", + example: "COUNT(arr)", params: [ { - type: 'Array', - name: 'arr', - description: '数组' + type: "Array", + name: "arr", + description: "数组" } ], returns: { - type: 'boolean', - description: '结果' + type: "boolean", + description: "结果" }, - namespace: '数组' + namespace: "数组" }, { - name: 'ARRAYMAP', - description: - '数组做数据转换,需要搭配箭头函数一起使用,注意箭头函数只支持单表达式用法。', - example: 'ARRAYMAP(arr, item => item)', + name: "ARRAYMAP", + description: "数组做数据转换,需要搭配箭头函数一起使用,注意箭头函数只支持单表达式用法。", + example: "ARRAYMAP(arr, item => item)", params: [ { - type: 'Array', - name: 'arr', - description: '数组' + type: "Array", + name: "arr", + description: "数组" }, { - type: 'Array', - name: 'iterator', - description: '箭头函数' + type: "Array", + name: "iterator", + description: "箭头函数" } ], returns: { - type: 'boolean', - description: '结果' + type: "boolean", + description: "结果" }, - namespace: '数组' + namespace: "数组" }, { - name: 'ARRAYFILTER', - description: - '数据做数据过滤,需要搭配箭头函数一起使用,注意箭头函数只支持单表达式用法。\n将第二个箭头函数返回为 false 的成员过滤掉。', - example: 'ARRAYFILTER(arr, item => item)', + name: "ARRAYFILTER", + description: "数据做数据过滤,需要搭配箭头函数一起使用,注意箭头函数只支持单表达式用法。\n将第二个箭头函数返回为 false 的成员过滤掉。", + example: "ARRAYFILTER(arr, item => item)", params: [ { - type: 'Array', - name: 'arr', - description: '数组' + type: "Array", + name: "arr", + description: "数组" }, { - type: 'Array', - name: 'iterator', - description: '箭头函数' + type: "Array", + name: "iterator", + description: "箭头函数" } ], returns: { - type: 'boolean', - description: '结果' + type: "boolean", + description: "结果" }, - namespace: '数组' + namespace: "数组" }, { - name: 'ARRAYFINDINDEX', - description: - '数据做数据查找,需要搭配箭头函数一起使用,注意箭头函数只支持单表达式用法。\n找出第二个箭头函数返回为 true 的成员的索引。\n\n示例:\n\nARRAYFINDINDEX([0, 2, false], item => item === 2) 得到 1。', - example: 'ARRAYFINDINDEX(arr, item => item === 2)', + name: "ARRAYFINDINDEX", + description: "数据做数据查找,需要搭配箭头函数一起使用,注意箭头函数只支持单表达式用法。\n找出第二个箭头函数返回为 true 的成员的索引。\n\n示例:\n\nARRAYFINDINDEX([0, 2, false], item => item === 2) 得到 1。", + example: "ARRAYFINDINDEX(arr, item => item === 2)", params: [ { - type: 'Array', - name: 'arr', - description: '数组' + type: "Array", + name: "arr", + description: "数组" }, { - type: 'Array', - name: 'iterator', - description: '箭头函数' + type: "Array", + name: "iterator", + description: "箭头函数" } ], returns: { - type: 'number', - description: '结果' + type: "number", + description: "结果" }, - namespace: '数组' + namespace: "数组" }, { - name: 'ARRAYFIND', - description: - '数据做数据查找,需要搭配箭头函数一起使用,注意箭头函数只支持单表达式用法。\n找出第二个箭头函数返回为 true 的成员。\n\n示例:\n\nARRAYFIND([0, 2, false], item => item === 2) 得到 2。', - example: 'ARRAYFIND(arr, item => item === 2)', + name: "ARRAYFIND", + description: "数据做数据查找,需要搭配箭头函数一起使用,注意箭头函数只支持单表达式用法。\n找出第二个箭头函数返回为 true 的成员。\n\n示例:\n\nARRAYFIND([0, 2, false], item => item === 2) 得到 2。", + example: "ARRAYFIND(arr, item => item === 2)", params: [ { - type: 'Array', - name: 'arr', - description: '数组' + type: "Array", + name: "arr", + description: "数组" }, { - type: 'Array', - name: 'iterator', - description: '箭头函数' + type: "Array", + name: "iterator", + description: "箭头函数" } ], returns: { - type: 'any', - description: '结果' + type: "any", + description: "结果" }, - namespace: '数组' + namespace: "数组" }, { - name: 'ARRAYSOME', - description: - '数据做数据遍历判断,需要搭配箭头函数一起使用,注意箭头函数只支持单表达式用法。\n判断第二个箭头函数是否存在返回为 true 的成员,是则返回 true,否则返回 false。\n\n示例:\n\nARRAYSOME([0, 2, false], item => item === 2) 得到 true。', - example: 'ARRAYSOME(arr, item => item === 2)', + name: "ARRAYSOME", + description: "数据做数据遍历判断,需要搭配箭头函数一起使用,注意箭头函数只支持单表达式用法。\n判断第二个箭头函数是否存在返回为 true 的成员,是则返回 true,否则返回 false。\n\n示例:\n\nARRAYSOME([0, 2, false], item => item === 2) 得到 true。", + example: "ARRAYSOME(arr, item => item === 2)", params: [ { - type: 'Array', - name: 'arr', - description: '数组' + type: "Array", + name: "arr", + description: "数组" }, { - type: 'Array', - name: 'iterator', - description: '箭头函数' + type: "Array", + name: "iterator", + description: "箭头函数" } ], returns: { - type: 'boolean', - description: '结果' + type: "boolean", + description: "结果" }, - namespace: '数组' + namespace: "数组" }, { - name: 'ARRAYEVERY', - description: - '数据做数据遍历判断,需要搭配箭头函数一起使用,注意箭头函数只支持单表达式用法。\n判断第二个箭头函数返回是否都为 true,是则返回 true,否则返回 false。\n\n示例:\n\nARRAYEVERY([0, 2, false], item => item === 2) 得到 false', - example: 'ARRAYEVERY(arr, item => item === 2)', + name: "ARRAYEVERY", + description: "数据做数据遍历判断,需要搭配箭头函数一起使用,注意箭头函数只支持单表达式用法。\n判断第二个箭头函数返回是否都为 true,是则返回 true,否则返回 false。\n\n示例:\n\nARRAYEVERY([0, 2, false], item => item === 2) 得到 false", + example: "ARRAYEVERY(arr, item => item === 2)", params: [ { - type: 'Array', - name: 'arr', - description: '数组' + type: "Array", + name: "arr", + description: "数组" }, { - type: 'Array', - name: 'iterator', - description: '箭头函数' + type: "Array", + name: "iterator", + description: "箭头函数" } ], returns: { - type: 'boolean', - description: '结果' + type: "boolean", + description: "结果" }, - namespace: '数组' + namespace: "数组" }, { - name: 'ARRAYINCLUDES', - description: - '判断数据中是否存在指定元素。\n\n示例:\n\nARRAYINCLUDES([0, 2, false], 2) 得到 true。', - example: 'ARRAYINCLUDES(arr, 2)', + name: "ARRAYINCLUDES", + description: "判断数据中是否存在指定元素。\n\n示例:\n\nARRAYINCLUDES([0, 2, false], 2) 得到 true。", + example: "ARRAYINCLUDES(arr, 2)", params: [ { - type: 'Array', - name: 'arr', - description: '数组' + type: "Array", + name: "arr", + description: "数组" }, { - type: 'any', - name: 'item', - description: '元素' + type: "any", + name: "item", + description: "元素" } ], returns: { - type: 'any', - description: '结果' + type: "any", + description: "结果" }, - namespace: '数组' + namespace: "数组" }, { - name: 'COMPACT', - description: - '数组过滤掉 false、null、0 和 ""。\n\n示例:\n\nCOMPACT([0, 1, false, 2, \'\', 3]) 得到 [1, 2, 3]。', - example: 'COMPACT(arr)', + name: "COMPACT", + description: "数组过滤掉 false、null、0 和 \"\"。\n\n示例:\n\nCOMPACT([0, 1, false, 2, '', 3]) 得到 [1, 2, 3]。", + example: "COMPACT(arr)", params: [ { - type: 'Array', - name: 'arr', - description: '数组' + type: "Array", + name: "arr", + description: "数组" } ], returns: { - type: 'Array', - description: '结果' + type: "Array", + description: "结果" }, - namespace: '数组' + namespace: "数组" }, { - name: 'JOIN', - description: - "数组转成字符串。\n\n示例:\n\nJOIN(['a', 'b', 'c'], '=') 得到 'a=b=c'。", - example: 'JOIN(arr, string)', + name: "JOIN", + description: "数组转成字符串。\n\n示例:\n\nJOIN(['a', 'b', 'c'], '=') 得到 'a=b=c'。", + example: "JOIN(arr, string)", params: [ { - type: 'Array', - name: 'arr', - description: '数组' + type: "Array", + name: "arr", + description: "数组" }, { - type: 'String', - name: 'separator', - description: '分隔符' + type: "String", + name: "separator", + description: "分隔符" } ], returns: { - type: 'String', - description: '结果' + type: "String", + description: "结果" }, - namespace: '数组' + namespace: "数组" }, { - name: 'CONCAT', - description: - "数组合并。\n\n示例:\n\nCONCAT(['a', 'b', 'c'], ['1'], ['3']) 得到 ['a', 'b', 'c', '1', '3']。", + name: "CONCAT", + description: "数组合并。\n\n示例:\n\nCONCAT(['a', 'b', 'c'], ['1'], ['3']) 得到 ['a', 'b', 'c', '1', '3']。", example: "CONCAT(['a', 'b', 'c'], ['1'], ['3'])", params: [ { - type: 'Array', - name: 'arr', - description: '数组' + type: "Array", + name: "arr", + description: "数组" } ], returns: { - type: 'Array', - description: '结果' + type: "Array", + description: "结果" }, - namespace: '数组' + namespace: "数组" }, { - name: 'UNIQ', - description: - "数组去重,第二个参数「field」,可指定根据该字段去重。\n\n示例:\n\nUNIQ([{a: '1'}, {b: '2'}, {a: '1'}], 'id')。", + name: "UNIQ", + description: "数组去重,第二个参数「field」,可指定根据该字段去重。\n\n示例:\n\nUNIQ([{a: '1'}, {b: '2'}, {a: '1'}], 'id')。", example: "UNIQ([{a: '1'}, {b: '2'}, {a: '1'}], 'x')", params: [ { - type: 'Array', - name: 'arr', - description: '数组' + type: "Array", + name: "arr", + description: "数组" }, { - type: 'string', - name: 'field', - description: '字段' + type: "string", + name: "field", + description: "字段" } ], returns: { - type: 'Array', - description: '结果' + type: "Array", + description: "结果" }, - namespace: '数组' + namespace: "数组" }, { - name: 'ENCODEJSON', - description: - '将JS对象转换成JSON字符串。\n\n示例:\n\nENCODEJSON({name: \'amis\'}) 得到 \'{"name":"amis"}\'。', + name: "ENCODEJSON", + description: "将JS对象转换成JSON字符串。\n\n示例:\n\nENCODEJSON({name: 'amis'}) 得到 '{\"name\":\"amis\"}'。", example: "ENCODEJSON({name: 'amis'})", params: [ { - type: 'object', - name: 'obj', - description: 'JS对象' + type: "object", + name: "obj", + description: "JS对象" } ], returns: { - type: 'string', - description: '结果' + type: "string", + description: "结果" }, - namespace: '编码' + namespace: "编码" }, { - name: 'DECODEJSON', - description: - '解析JSON编码数据,返回JS对象。\n\n示例:\n\nDECODEJSON(\'{\\"name\\": "amis"}\') 得到 {name: \'amis\'}。', - example: 'DECODEJSON(\'{\\"name\\": "amis"}\')', + name: "DECODEJSON", + description: "解析JSON编码数据,返回JS对象。\n\n示例:\n\nDECODEJSON('{\\\"name\\\": \"amis\"}') 得到 {name: 'amis'}。", + example: "DECODEJSON('{\\\"name\\\": \"amis\"}')", params: [ { - type: 'string', - name: 'str', - description: '字符串' + type: "string", + name: "str", + description: "字符串" } ], returns: { - type: 'object', - description: '结果' + type: "object", + description: "结果" }, - namespace: '编码' + namespace: "编码" }, { - name: 'GET', - description: - "根据对象或者数组的path路径获取值。 如果解析 value 是 undefined 会以 defaultValue 取代。\n\n示例:\n\nGET([0, 2, {name: 'amis', age: 18}], 1) 得到 2,\nGET([0, 2, {name: 'amis', age: 18}], '2.name') 得到 'amis',\nGET({arr: [{name: 'amis', age: 18}]}, 'arr[0].name') 得到 'amis',\nGET({arr: [{name: 'amis', age: 18}]}, 'arr.0.name') 得到 'amis',\nGET({arr: [{name: 'amis', age: 18}]}, 'arr.1.name', 'not-found') 得到 'not-found'。", - example: 'GET(arr, 2)', + name: "GET", + description: "根据对象或者数组的path路径获取值。 如果解析 value 是 undefined 会以 defaultValue 取代。\n\n示例:\n\nGET([0, 2, {name: 'amis', age: 18}], 1) 得到 2,\nGET([0, 2, {name: 'amis', age: 18}], '2.name') 得到 'amis',\nGET({arr: [{name: 'amis', age: 18}]}, 'arr[0].name') 得到 'amis',\nGET({arr: [{name: 'amis', age: 18}]}, 'arr.0.name') 得到 'amis',\nGET({arr: [{name: 'amis', age: 18}]}, 'arr.1.name', 'not-found') 得到 'not-found'。", + example: "GET(arr, 2)", params: [ { - type: 'any', - name: 'obj', - description: '对象或数组' + type: "any", + name: "obj", + description: "对象或数组" }, { - type: 'string', - name: 'path', - description: '路径' + type: "string", + name: "path", + description: "路径" }, { - type: 'any', - name: 'defaultValue', - description: '如果解析不到则返回该值' + type: "any", + name: "defaultValue", + description: "如果解析不到则返回该值" } ], returns: { - type: 'any', - description: '结果' + type: "any", + description: "结果" }, - namespace: '其他' + namespace: "其他" }, { - name: 'ISTYPE', - description: - '判断是否为类型支持:string, number, array, date, plain-object。', + name: "ISTYPE", + description: "判断是否为类型支持:string, number, array, date, plain-object。", example: "ISTYPE([{a: '1'}, {b: '2'}, {a: '1'}], 'array')", params: [ { - type: 'string', - name: '判断对象', + type: "string", + name: "判断对象", description: null } ], returns: { - type: 'boolean', - description: '结果' + type: "boolean", + description: "结果" }, - namespace: '其他' + namespace: "其他" } -]; +]; \ No newline at end of file diff --git a/packages/amis-ui/src/components/formula/Editor.tsx b/packages/amis-ui/src/components/formula/Editor.tsx index a66f936bb8c..d02698b0387 100644 --- a/packages/amis-ui/src/components/formula/Editor.tsx +++ b/packages/amis-ui/src/components/formula/Editor.tsx @@ -73,6 +73,12 @@ export interface FormulaEditorProps extends ThemeProps, LocaleProps { */ functions?: Array; + /** + * 是否清除默认公式 + * 默认为 false + */ + clearDefaultFormula: boolean; + /** * 顶部标题,默认为表达式 */ @@ -273,14 +279,22 @@ export class FormulaEditor extends React.Component< if (this.unmounted) { return; } + const customFunctions = Array.isArray(this.props.functions) ? this.props.functions : []; - const functionList = [ - ...FormulaEditor.buildDefaultFunctions(doc), - ...FormulaEditor.buildCustomFunctions(functionDocs), - ...customFunctions - ]; + + const functionList = this.props.clearDefaultFormula + ? [ + ...FormulaEditor.buildCustomFunctions(functionDocs), + ...customFunctions + ] + : [ + ...FormulaEditor.buildDefaultFunctions(doc), + ...FormulaEditor.buildCustomFunctions(functionDocs), + ...customFunctions + ]; + this.setState({ functions: functionList }); diff --git a/packages/amis-ui/src/components/formula/Picker.tsx b/packages/amis-ui/src/components/formula/Picker.tsx index 5181b69a17d..0d110acf7b6 100644 --- a/packages/amis-ui/src/components/formula/Picker.tsx +++ b/packages/amis-ui/src/components/formula/Picker.tsx @@ -121,6 +121,12 @@ export interface FormulaPickerProps */ clearable?: boolean; + /** + * 是否清除默认公式 + * 默认为 false + */ + clearDefaultFormula: boolean; + /** * 支持通过上下文变量配置value */ @@ -445,6 +451,7 @@ export class FormulaPicker extends React.Component< title, clearable, functions, + clearDefaultFormula, children, variableMode, mixedMode, @@ -594,6 +601,7 @@ export class FormulaPicker extends React.Component< evalMode={mixedMode ? true : evalMode} variables={this.state.variables} functions={this.state.functions ?? functions} + clearDefaultFormula={clearDefaultFormula} variableMode={this.state.variableMode ?? variableMode} value={editorValue} onChange={this.handleEditorChange} @@ -625,6 +633,7 @@ export class FormulaPicker extends React.Component< evalMode={mixedMode ? true : evalMode} variables={this.state.variables} functions={this.state.functions ?? functions} + clearDefaultFormula={clearDefaultFormula} variableMode={this.state.variableMode ?? variableMode} value={editorValue} onChange={this.handleEditorChange} diff --git a/packages/amis/__tests__/renderers/Form/inputFormula.test.tsx b/packages/amis/__tests__/renderers/Form/inputFormula.test.tsx index c795f5816bb..1b8d5a21e24 100644 --- a/packages/amis/__tests__/renderers/Form/inputFormula.test.tsx +++ b/packages/amis/__tests__/renderers/Form/inputFormula.test.tsx @@ -18,7 +18,6 @@ test('Renderer:input-formula', async () => { name: 'formula', label: '公式', evalMode: false, - value: 'SUM(1 + 2)', variables: [ { label: '表单字段', diff --git a/packages/amis/src/renderers/Form/InputFormula.tsx b/packages/amis/src/renderers/Form/InputFormula.tsx index 8b4da44b7f5..c2320f3dabb 100644 --- a/packages/amis/src/renderers/Form/InputFormula.tsx +++ b/packages/amis/src/renderers/Form/InputFormula.tsx @@ -49,6 +49,12 @@ export interface InputFormulaControlSchema extends FormBaseControlSchema { */ functions: Array; + /** + * 是否清除默认公式 + * 默认为 false + */ + clearDefaultFormula: boolean; + /** * 编辑器标题 */ @@ -141,11 +147,12 @@ export interface InputFormulaProps export class InputFormulaRenderer extends React.Component { static defaultProps: Pick< InputFormulaControlSchema, - 'inputMode' | 'borderMode' | 'evalMode' + 'inputMode' | 'borderMode' | 'evalMode' | 'clearDefaultFormula' > = { inputMode: 'input-button', borderMode: 'full', - evalMode: true + evalMode: true, + clearDefaultFormula: false }; ref: any; @@ -180,6 +187,7 @@ export class InputFormulaRenderer extends React.Component { onChange, evalMode, mixedMode, + clearDefaultFormula, variableMode, header, label, @@ -210,6 +218,7 @@ export class InputFormulaRenderer extends React.Component { } = this.props; let {variables, functions} = this.props; + console.log('clearDefaultFormula=======ccc', clearDefaultFormula); if (isPureVariable(variables)) { // 如果 variables 是 ${xxx} 这种形式,将其处理成实际的值 variables = resolveVariableAndFilter(variables, this.props.data, '| raw'); @@ -233,6 +242,7 @@ export class InputFormulaRenderer extends React.Component { variables={variables} variableMode={variableMode} functions={functions} + clearDefaultFormula={clearDefaultFormula} header={header || label || ''} borderMode={borderMode} placeholder={placeholder} From 48d0b6e29206c734064922e99ce8781494ff79f0 Mon Sep 17 00:00:00 2001 From: srleng Date: Thu, 7 Sep 2023 16:47:16 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B8=85=E9=99=A4?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=87=BD=E6=95=B0=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/polyfills/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/polyfills/index.ts b/examples/polyfills/index.ts index be97e89b72b..c729415d09f 100644 --- a/examples/polyfills/index.ts +++ b/examples/polyfills/index.ts @@ -14,7 +14,7 @@ import 'core-js/es/map'; import 'core-js/es/set'; import 'core-js/es/symbol'; -// // @ts-ignore -// import './cloest'; -// // @ts-ignore -// import './classList'; +// @ts-ignore +import './cloest'; +// @ts-ignore +import './classList'; From c66679652900e3e9faf6aa89b45fc4b8d786a2e7 Mon Sep 17 00:00:00 2001 From: srleng Date: Thu, 7 Sep 2023 16:53:15 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=8E=BB=E9=99=A4log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis/src/renderers/Form/InputFormula.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/amis/src/renderers/Form/InputFormula.tsx b/packages/amis/src/renderers/Form/InputFormula.tsx index c2320f3dabb..f2447569659 100644 --- a/packages/amis/src/renderers/Form/InputFormula.tsx +++ b/packages/amis/src/renderers/Form/InputFormula.tsx @@ -218,7 +218,6 @@ export class InputFormulaRenderer extends React.Component { } = this.props; let {variables, functions} = this.props; - console.log('clearDefaultFormula=======ccc', clearDefaultFormula); if (isPureVariable(variables)) { // 如果 variables 是 ${xxx} 这种形式,将其处理成实际的值 variables = resolveVariableAndFilter(variables, this.props.data, '| raw');