From ec7a5fb53433cb5d3f93131e8dc99b810bccaec4 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Sun, 29 Jun 2025 21:27:10 +0800 Subject: [PATCH] refactor: code improve --- .../client/src/flow/models/common/utils.ts | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 packages/core/client/src/flow/models/common/utils.ts diff --git a/packages/core/client/src/flow/models/common/utils.ts b/packages/core/client/src/flow/models/common/utils.ts deleted file mode 100644 index 761a7bd8c3..0000000000 --- a/packages/core/client/src/flow/models/common/utils.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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 { isTitleField } from '../../../data-source'; - -export const loadTitleFieldOptions = (collectionField, dataSourceManager) => { - return async (field) => { - const form = field.form; - const compile = form?.designable?.compile || ((v) => v); - - const collectionManager = collectionField?.collection?.collectionManager; - const target = collectionField?.options?.target; - if (!collectionManager || !target) return; - - const targetCollection = collectionManager.getCollection(target); - const targetFields = targetCollection?.getFields?.() ?? []; - - field.loading = true; - - const options = targetFields - .filter((field) => isTitleField(dataSourceManager, field.options)) - .map((field) => ({ - value: field.name, - label: compile(field.options.uiSchema?.title) || field.name, - })); - - field.dataSource = options; - field.loading = false; - }; -};