From 9928424f5a163fe4edd7cfd60f349ca65b47c9bf Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 1 Jul 2022 09:35:36 +0800 Subject: [PATCH] feat(client): integer field --- .../collection-manager/interfaces/index.ts | 3 +- .../collection-manager/interfaces/integer.ts | 31 +++++++++++++++++++ packages/core/client/src/locale/en_US.ts | 1 + packages/core/client/src/locale/zh_CN.ts | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 packages/core/client/src/collection-manager/interfaces/integer.ts diff --git a/packages/core/client/src/collection-manager/interfaces/index.ts b/packages/core/client/src/collection-manager/interfaces/index.ts index 997b20e5f..3b2a13772 100644 --- a/packages/core/client/src/collection-manager/interfaces/index.ts +++ b/packages/core/client/src/collection-manager/interfaces/index.ts @@ -6,9 +6,11 @@ export * from './createdAt'; export * from './createdBy'; export * from './datetime'; export * from './email'; +export * from './formula'; export * from './icon'; export * from './id'; export * from './input'; +export * from './integer'; export * from './linkTo'; export * from './m2m'; export * from './m2o'; @@ -28,5 +30,4 @@ export * from './textarea'; export * from './time'; export * from './updatedAt'; export * from './updatedBy'; -export * from './formula'; diff --git a/packages/core/client/src/collection-manager/interfaces/integer.ts b/packages/core/client/src/collection-manager/interfaces/integer.ts new file mode 100644 index 000000000..b9c9533fe --- /dev/null +++ b/packages/core/client/src/collection-manager/interfaces/integer.ts @@ -0,0 +1,31 @@ +import { defaultProps, operators } from './properties'; +import { IField } from './types'; + +export const integer: IField = { + name: 'integer', + type: 'object', + group: 'basic', + order: 5, + title: '{{t("Integer")}}', + sortable: true, + default: { + type: 'integer', + // name, + uiSchema: { + type: 'number', + // title, + 'x-component': 'InputNumber', + 'x-component-props': { + stringMode: true, + step: '0', + }, + 'x-validator': 'integer', + }, + }, + properties: { + ...defaultProps, + }, + filterable: { + operators: operators.number, + }, +}; diff --git a/packages/core/client/src/locale/en_US.ts b/packages/core/client/src/locale/en_US.ts index d4a7e6474..c4648a03d 100644 --- a/packages/core/client/src/locale/en_US.ts +++ b/packages/core/client/src/locale/en_US.ts @@ -120,6 +120,7 @@ export default { "Phone": "Phone", "Email": "Email", "Number": "Number", + "Integer": "Integer", "Percent": "Percent", "Password": "Password", "Formula": "Formula", diff --git a/packages/core/client/src/locale/zh_CN.ts b/packages/core/client/src/locale/zh_CN.ts index ccf4103c5..c90ac1b39 100644 --- a/packages/core/client/src/locale/zh_CN.ts +++ b/packages/core/client/src/locale/zh_CN.ts @@ -123,6 +123,7 @@ export default { "Phone": "手机号码", "Email": "电子邮箱", "Number": "数字", + "Integer": "整数", "Percent": "百分比", "Password": "密码", "Formula": "公式",