From 94aa8df382ddc670f15134269cffc7a736e0100a Mon Sep 17 00:00:00 2001 From: YANG QIA <2013xile@gmail.com> Date: Fri, 23 Aug 2024 15:47:11 +0800 Subject: [PATCH 1/2] fix(data-vi): allow to map integer enum value (#5115) --- .../src/client/__tests__/utils.test.ts | 44 +++++++++++++++++++ .../src/client/utils.ts | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 packages/plugins/@nocobase/plugin-data-visualization/src/client/__tests__/utils.test.ts diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/__tests__/utils.test.ts b/packages/plugins/@nocobase/plugin-data-visualization/src/client/__tests__/utils.test.ts new file mode 100644 index 0000000000..b862bedd63 --- /dev/null +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/__tests__/utils.test.ts @@ -0,0 +1,44 @@ +/** + * This file is part of the NocoBase (R) project. + * Copyright (c) 2020-2024 NocoBase Co., Ltd. + * Authors: NocoBase Team. + * + * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. + * For more information, please refer to: https://www.nocobase.com/agreement. + */ + +import { processData } from '../utils'; + +describe('utils', () => { + it('processFields', () => { + expect( + processData( + [ + { + name: 'tag', + type: 'bigInt', + interface: 'select', + uiSchema: { + type: 'string', + enum: [ + { + value: '1', + label: 'Yes', + }, + { + value: '2', + label: 'No', + }, + ], + }, + label: 'Tag', + value: 'tag', + key: 'tag', + }, + ], + [{ tag: 1 }], + {}, + ), + ).toEqual([{ tag: 'Yes' }]); + }); +}); diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/utils.ts b/packages/plugins/@nocobase/plugin-data-visualization/src/client/utils.ts index e1a098c983..a823640fa5 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/utils.ts +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/utils.ts @@ -93,7 +93,7 @@ export const processData = (selectedFields: FieldOption[], data: any[], scope: a if (Array.isArray(value)) { return value.map((v) => parseEnum(field, v)); } - const option = options.find((option) => option.value === value); + const option = options.find((option) => option.value === (value?.toString?.() || value)); return Schema.compile(option?.label || value, scope); }; return data.map((record) => { From 75c7fd67964d74d291c2f97efa0c458113b7870b Mon Sep 17 00:00:00 2001 From: Zhou Date: Fri, 23 Aug 2024 16:04:33 +0800 Subject: [PATCH 2/2] Update README.zh-CN.md --- README.zh-CN.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index 733a5acc68..ab46ddc66e 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -2,11 +2,14 @@ https://github.com/nocobase/nocobase/assets/1267426/29623e45-9a48-4598-bb9e-9dd173ade553 -## 感谢你的支持! +## 感谢支持 nocobase%2Fnocobase | Trendshift NocoBase - Scalability-first, open-source no-code platform | Product Hunt +## 加入我们 +我们正在招聘**远程开发工程师**和**远程测试工程师**。 欢迎对 NocoBase 有强烈兴趣的伙伴加入。[查看详情](https://www.nocobase.com/cn/recruitment) + ## 最近重要更新 - [v1.0.1-alpha.1:区块支持高度设置 - 2024/06/07](https://docs-cn.nocobase.com/welcome/changelog/20240607) - [v1.0.0-alpha.15:新增插件、改进「配置操作」交互 - 2024/05/19](https://docs-cn.nocobase.com/welcome/changelog/20240519)