feat: rename filter to helper

This commit is contained in:
Sheldon Guo 2025-03-18 16:25:10 +08:00
parent 51693d9a82
commit a9f1e15ec6
7 changed files with 13 additions and 9 deletions

View File

@ -476,6 +476,8 @@
"Action permissions": "Action permissions",
"Menu permissions": "Menu permissions",
"Menu item name": "Menu item name",
"Input value": "Input value",
"Output value": "Output value",
"Allow access": "Allow access",
"Action name": "Action name",
"Allow action": "Allow action",

View File

@ -1033,6 +1033,8 @@
"Left": "左",
"Center": "居中",
"Right": "右",
"Input value": "输入值",
"Output value": "输出值",
"Divider line color": "分割线颜色",
"Label align": "字段标题对齐方式",
"Label width": "字段标题宽度",

View File

@ -8,14 +8,14 @@
*/
import { Plugin } from '@nocobase/client';
import { filterGroups, variableFilters } from '../json-template-filters';
import { helperGroups, helpers } from '../json-template-helpers';
export class PluginVariableFiltersClient extends Plugin {
async afterAdd() {
filterGroups.forEach((group) => {
helperGroups.forEach((group) => {
this.app.jsonTemplateParser.registerFilterGroup(group);
});
variableFilters.forEach((filter) => {
helpers.forEach((filter) => {
this.app.jsonTemplateParser.registerFilter(filter);
});
}

View File

@ -9,13 +9,13 @@
import { first } from './array';
import { dateAdd, dateFormat, dateSubtract } from './date';
const NAMESPACE = 'variable-filters';
const NAMESPACE = 'variable-helpers';
function tval(text: string) {
return `{{t(${JSON.stringify(text)}, ${JSON.stringify({ ns: NAMESPACE, nsMode: 'fallback' })})}}`;
}
export const variableFilters = [
export const helpers = [
{
name: 'date_format',
title: 'format',
@ -112,7 +112,7 @@ export const variableFilters = [
},
];
export const filterGroups = [
export const helperGroups = [
{
name: 'date',
title: "{{t('Date')}}",

View File

@ -8,18 +8,18 @@
*/
import { Plugin } from '@nocobase/server';
import { variableFilters, filterGroups } from '../json-template-filters';
import { helperGroups, helpers } from '../json-template-helpers';
export class PluginVariableFiltersServer extends Plugin {
async afterAdd() {}
async beforeLoad() {}
async load() {
filterGroups.forEach((group) => {
helperGroups.forEach((group) => {
this.app.jsonTemplateParser.registerFilterGroup(group);
});
variableFilters.forEach((filter) => {
helpers.forEach((filter) => {
this.app.jsonTemplateParser.registerFilter(filter);
});
}