mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 05:29:26 +08:00
* feat: support variables in secondary confirmation title and content * fix: bug * fix: build error * fix: e2e * fix: test * fix: test * fix: test * fix: test * fix: bug * fix: e2e test * fix: e2e test * fix: e2e test * fix: e2e test * fix: e2e test
24 lines
774 B
TypeScript
24 lines
774 B
TypeScript
/**
|
|
* 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 { evaluators } from '@nocobase/evaluators/client';
|
|
import { replaceVariables } from '../schema-settings/LinkageRules/bindLinkageRulesToFiled';
|
|
|
|
export const getVariableValue = async (text: string, scopes) => {
|
|
if (!text) {
|
|
return text;
|
|
}
|
|
|
|
const { evaluate } = evaluators.get('string');
|
|
|
|
const { exp, scope: expScope } = await replaceVariables(text, scopes);
|
|
const result = evaluate(exp, { now: () => new Date().toString(), ...expScope });
|
|
return result;
|
|
};
|