feat: translations
This commit is contained in:
parent
5c6a39f2f4
commit
5c0184a397
@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>Your App</title>
|
<title>Loading...</title>
|
||||||
<script>
|
<script>
|
||||||
showLog=true;function log(m){if(window.console&&showLog){console.log(m)}}function css_browser_selector(u){var uaInfo={},screens=[320,480,640,768,1024,1152,1280,1440,1680,1920,2560],allScreens=screens.length,ua=u.toLowerCase(),is=function(t){return RegExp(t,'i').test(ua)},version=function(p,n){n=n.replace('.','_');var i=n.indexOf('_'),ver='';while(i>0){ver+=' '+p+n.substring(0,i);i=n.indexOf('_',i+1)}ver+=' '+p+n;return ver},g='gecko',w='webkit',c='chrome',f='firefox',s='safari',o='opera',m='mobile',a='android',bb='blackberry',lang='lang_',dv='device_',html=document.documentElement,b=[(!/opera|webtv/i.test(ua)&&/msie\s(\d+)/.test(ua))||/trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.test(ua)?'ie ie'+(/trident\/4\.0/.test(ua)?'8':RegExp.$1=='11.0'?'11':RegExp.$1):is('firefox/')?g+' '+f+(/firefox\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)?' '+f+RegExp.$2+' '+f+RegExp.$2+'_'+RegExp.$4:''):is('gecko/')?g:is('opera')?o+(/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)?' '+o+RegExp.$2+' '+o+RegExp.$2+'_'+RegExp.$4:/opera(\s|\/)(\d+)\.(\d+)/.test(ua)?' '+o+RegExp.$2+' '+o+RegExp.$2+'_'+RegExp.$3:''):is('konqueror')?'konqueror':is('blackberry')?bb+(/Version\/(\d+)(\.(\d+)+)/i.test(ua)?' '+bb+RegExp.$1+' '+bb+RegExp.$1+RegExp.$2.replace('.','_'):/Blackberry ?(([0-9]+)([a-z]?))[\/|;]/gi.test(ua)?' '+bb+RegExp.$2+(RegExp.$3?' '+bb+RegExp.$2+RegExp.$3:''):''):is('android')?a+(/Version\/(\d+)(\.(\d+))+/i.test(ua)?' '+a+RegExp.$1+' '+a+RegExp.$1+RegExp.$2.replace('.','_'):'')+(/Android (.+); (.+) Build/i.test(ua)?' '+dv+RegExp.$2.replace(/ /g,'_').replace(/-/g,'_'):''):is('chrome')?w+' '+c+(/chrome\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)?' '+c+RegExp.$2+(RegExp.$4>0?' '+c+RegExp.$2+'_'+RegExp.$4:''):''):is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)?' '+s+RegExp.$2+' '+s+RegExp.$2+RegExp.$3.replace('.','_'):/ Safari\/(\d+)/i.test(ua)?RegExp.$1=='419'||RegExp.$1=='417'||RegExp.$1=='416'||RegExp.$1=='412'?' '+s+'2_0':RegExp.$1=='312'?' '+s+'1_3':RegExp.$1=='125'?' '+s+'1_2':RegExp.$1=='85'?' '+s+'1_0':'':''):is('mozilla/')?g:'',is('android|mobi|mobile|j2me|iphone|ipod|ipad|blackberry|playbook|kindle|silk',)?m:'',is('j2me')?'j2me':is('ipad|ipod|iphone')?(/CPU( iPhone)? OS (\d+[_|\.]\d+([_|\.]\d+)*)/i.test(ua)?'ios'+version('ios',RegExp.$2):'')+' '+(/(ip(ad|od|hone))/gi.test(ua)?RegExp.$1:''):is('playbook')?'playbook':is('kindle|silk')?'kindle':is('playbook')?'playbook':is('mac')?'mac'+(/mac os x ((\d+)[.|_](\d+))/.test(ua)?' mac'+RegExp.$2+' mac'+RegExp.$1.replace('.','_'):''):is('win')?'win'+(is('windows nt 6.2')?' win8':is('windows nt 6.1')?' win7':is('windows nt 6.0')?' vista':is('windows nt 5.2')||is('windows nt 5.1')?' win_xp':is('windows nt 5.0')?' win_2k':is('windows nt 4.0')||is('WinNT4.0')?' win_nt':''):is('freebsd')?'freebsd':is('x11|linux')?'linux':'',/[; |\[](([a-z]{2})(\-[a-z]{2})?)[)|;|\]]/i.test(ua)?(lang+RegExp.$2).replace('-','_')+(RegExp.$3!=''?(' '+lang+RegExp.$1).replace('-','_'):''):'',is('ipad|iphone|ipod')&&!is('safari')?'ipad_app':'',];console.debug(ua);function screenSize(){var w=window.outerWidth||html.clientWidth;var h=window.outerHeight||html.clientHeight;uaInfo.orientation=w<h?'portrait':'landscape';html.className=html.className.replace(/ ?orientation_\w+/g,'').replace(/ [min|max|cl]+[w|h]_\d+/g,'');for(var i=allScreens-1;i>=0;i--){if(w>=screens[i]){uaInfo.maxw=screens[i];break}}widthClasses='';for(var info in uaInfo){widthClasses+=' '+info+'_'+uaInfo[info]}html.className=html.className+widthClasses;return widthClasses}window.onresize=screenSize;screenSize();function retina(){var r=window.devicePixelRatio>1;if(r){html.className+=' retina'}else{html.className+=' non-retina'}}retina();var cssbs=b.join(' ')+' js ';html.className=(cssbs+html.className.replace(/\b(no[-|_]?)?js\b/g,'')).replace(/^ /,'').replace(/ +/g,' ');return cssbs}css_browser_selector(navigator.userAgent);
|
showLog=true;function log(m){if(window.console&&showLog){console.log(m)}}function css_browser_selector(u){var uaInfo={},screens=[320,480,640,768,1024,1152,1280,1440,1680,1920,2560],allScreens=screens.length,ua=u.toLowerCase(),is=function(t){return RegExp(t,'i').test(ua)},version=function(p,n){n=n.replace('.','_');var i=n.indexOf('_'),ver='';while(i>0){ver+=' '+p+n.substring(0,i);i=n.indexOf('_',i+1)}ver+=' '+p+n;return ver},g='gecko',w='webkit',c='chrome',f='firefox',s='safari',o='opera',m='mobile',a='android',bb='blackberry',lang='lang_',dv='device_',html=document.documentElement,b=[(!/opera|webtv/i.test(ua)&&/msie\s(\d+)/.test(ua))||/trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.test(ua)?'ie ie'+(/trident\/4\.0/.test(ua)?'8':RegExp.$1=='11.0'?'11':RegExp.$1):is('firefox/')?g+' '+f+(/firefox\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)?' '+f+RegExp.$2+' '+f+RegExp.$2+'_'+RegExp.$4:''):is('gecko/')?g:is('opera')?o+(/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)?' '+o+RegExp.$2+' '+o+RegExp.$2+'_'+RegExp.$4:/opera(\s|\/)(\d+)\.(\d+)/.test(ua)?' '+o+RegExp.$2+' '+o+RegExp.$2+'_'+RegExp.$3:''):is('konqueror')?'konqueror':is('blackberry')?bb+(/Version\/(\d+)(\.(\d+)+)/i.test(ua)?' '+bb+RegExp.$1+' '+bb+RegExp.$1+RegExp.$2.replace('.','_'):/Blackberry ?(([0-9]+)([a-z]?))[\/|;]/gi.test(ua)?' '+bb+RegExp.$2+(RegExp.$3?' '+bb+RegExp.$2+RegExp.$3:''):''):is('android')?a+(/Version\/(\d+)(\.(\d+))+/i.test(ua)?' '+a+RegExp.$1+' '+a+RegExp.$1+RegExp.$2.replace('.','_'):'')+(/Android (.+); (.+) Build/i.test(ua)?' '+dv+RegExp.$2.replace(/ /g,'_').replace(/-/g,'_'):''):is('chrome')?w+' '+c+(/chrome\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)?' '+c+RegExp.$2+(RegExp.$4>0?' '+c+RegExp.$2+'_'+RegExp.$4:''):''):is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)?' '+s+RegExp.$2+' '+s+RegExp.$2+RegExp.$3.replace('.','_'):/ Safari\/(\d+)/i.test(ua)?RegExp.$1=='419'||RegExp.$1=='417'||RegExp.$1=='416'||RegExp.$1=='412'?' '+s+'2_0':RegExp.$1=='312'?' '+s+'1_3':RegExp.$1=='125'?' '+s+'1_2':RegExp.$1=='85'?' '+s+'1_0':'':''):is('mozilla/')?g:'',is('android|mobi|mobile|j2me|iphone|ipod|ipad|blackberry|playbook|kindle|silk',)?m:'',is('j2me')?'j2me':is('ipad|ipod|iphone')?(/CPU( iPhone)? OS (\d+[_|\.]\d+([_|\.]\d+)*)/i.test(ua)?'ios'+version('ios',RegExp.$2):'')+' '+(/(ip(ad|od|hone))/gi.test(ua)?RegExp.$1:''):is('playbook')?'playbook':is('kindle|silk')?'kindle':is('playbook')?'playbook':is('mac')?'mac'+(/mac os x ((\d+)[.|_](\d+))/.test(ua)?' mac'+RegExp.$2+' mac'+RegExp.$1.replace('.','_'):''):is('win')?'win'+(is('windows nt 6.2')?' win8':is('windows nt 6.1')?' win7':is('windows nt 6.0')?' vista':is('windows nt 5.2')||is('windows nt 5.1')?' win_xp':is('windows nt 5.0')?' win_2k':is('windows nt 4.0')||is('WinNT4.0')?' win_nt':''):is('freebsd')?'freebsd':is('x11|linux')?'linux':'',/[; |\[](([a-z]{2})(\-[a-z]{2})?)[)|;|\]]/i.test(ua)?(lang+RegExp.$2).replace('-','_')+(RegExp.$3!=''?(' '+lang+RegExp.$1).replace('-','_'):''):'',is('ipad|iphone|ipod')&&!is('safari')?'ipad_app':'',];console.debug(ua);function screenSize(){var w=window.outerWidth||html.clientWidth;var h=window.outerHeight||html.clientHeight;uaInfo.orientation=w<h?'portrait':'landscape';html.className=html.className.replace(/ ?orientation_\w+/g,'').replace(/ [min|max|cl]+[w|h]_\d+/g,'');for(var i=allScreens-1;i>=0;i--){if(w>=screens[i]){uaInfo.maxw=screens[i];break}}widthClasses='';for(var info in uaInfo){widthClasses+=' '+info+'_'+uaInfo[info]}html.className=html.className+widthClasses;return widthClasses}window.onresize=screenSize;screenSize();function retina(){var r=window.devicePixelRatio>1;if(r){html.className+=' retina'}else{html.className+=' non-retina'}}retina();var cssbs=b.join(' ')+' js ';html.className=(cssbs+html.className.replace(/\b(no[-|_]?)?js\b/g,'')).replace(/^ /,'').replace(/ +/g,' ');return cssbs}css_browser_selector(navigator.userAgent);
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import { Checkbox, message, Table } from 'antd';
|
import { Checkbox, message, Table } from 'antd';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useAPIClient, useRequest } from '../../api-client';
|
import { useAPIClient, useRequest } from '../../api-client';
|
||||||
import { useRecord } from '../../record-provider';
|
import { useRecord } from '../../record-provider';
|
||||||
|
import { useCompile } from '../../schema-component';
|
||||||
import { useMenuItems } from './RoleTable';
|
import { useMenuItems } from './RoleTable';
|
||||||
|
|
||||||
const findUids = (items) => {
|
const findUids = (items) => {
|
||||||
@ -20,6 +22,8 @@ export const MenuConfigure = () => {
|
|||||||
const record = useRecord();
|
const record = useRecord();
|
||||||
const api = useAPIClient();
|
const api = useAPIClient();
|
||||||
const items = useMenuItems();
|
const items = useMenuItems();
|
||||||
|
const compile = useCompile();
|
||||||
|
const { t } = useTranslation();
|
||||||
const allUids = findUids(items);
|
const allUids = findUids(items);
|
||||||
const [uids, setUids] = useState([]);
|
const [uids, setUids] = useState([]);
|
||||||
const { loading, refresh } = useRequest(
|
const { loading, refresh } = useRequest(
|
||||||
@ -50,7 +54,7 @@ export const MenuConfigure = () => {
|
|||||||
columns={[
|
columns={[
|
||||||
{
|
{
|
||||||
dataIndex: 'title',
|
dataIndex: 'title',
|
||||||
title: '菜单项',
|
title: t('Menu item title'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'accessible',
|
dataIndex: 'accessible',
|
||||||
@ -69,10 +73,10 @@ export const MenuConfigure = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
refresh();
|
refresh();
|
||||||
message.success('保存成功');
|
message.success(t('Saved successfully'));
|
||||||
}}
|
}}
|
||||||
/>{' '}
|
/>{' '}
|
||||||
允许访问
|
{t('Accessible')}
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
render: (_, schema) => {
|
render: (_, schema) => {
|
||||||
@ -93,7 +97,7 @@ export const MenuConfigure = () => {
|
|||||||
tk: schema.uid,
|
tk: schema.uid,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
message.success('保存成功');
|
message.success(t('Saved successfully'));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -85,14 +85,14 @@ export const RolesResourcesActions = connect((props) => {
|
|||||||
<div>
|
<div>
|
||||||
<RoleResourceCollectionContext.Provider value={collection}>
|
<RoleResourceCollectionContext.Provider value={collection}>
|
||||||
<FormLayout layout={'vertical'}>
|
<FormLayout layout={'vertical'}>
|
||||||
<FormItem label={'操作权限'}>
|
<FormItem label={t('Action permission')}>
|
||||||
<Table
|
<Table
|
||||||
size={'small'}
|
size={'small'}
|
||||||
pagination={false}
|
pagination={false}
|
||||||
columns={[
|
columns={[
|
||||||
{
|
{
|
||||||
dataIndex: 'displayName',
|
dataIndex: 'displayName',
|
||||||
title: '操作',
|
title: t('Action display name'),
|
||||||
render: (value) => compile(value),
|
render: (value) => compile(value),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -148,14 +148,14 @@ export const RolesResourcesActions = connect((props) => {
|
|||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label={'字段权限'}>
|
<FormItem label={t('Field permission')}>
|
||||||
<Table
|
<Table
|
||||||
pagination={false}
|
pagination={false}
|
||||||
dataSource={fieldPermissions}
|
dataSource={fieldPermissions}
|
||||||
columns={[
|
columns={[
|
||||||
{
|
{
|
||||||
dataIndex: ['uiSchema', 'title'],
|
dataIndex: ['uiSchema', 'title'],
|
||||||
title: '字段名称',
|
title: t('Field display name'),
|
||||||
render: (value) => compile(value),
|
render: (value) => compile(value),
|
||||||
},
|
},
|
||||||
...availableActionsWithFields.map((action) => {
|
...availableActionsWithFields.map((action) => {
|
||||||
|
@ -12,34 +12,34 @@ const collection = {
|
|||||||
name: 'title',
|
name: 'title',
|
||||||
interface: 'input',
|
interface: 'input',
|
||||||
uiSchema: {
|
uiSchema: {
|
||||||
title: '数据表名称',
|
title: '{{t("Collection display name")}}',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
'x-component': 'Input',
|
'x-component': 'Input',
|
||||||
required: true,
|
required: true,
|
||||||
} as ISchema,
|
} as ISchema,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
name: 'name',
|
// name: 'name',
|
||||||
interface: 'input',
|
// interface: 'input',
|
||||||
uiSchema: {
|
// uiSchema: {
|
||||||
title: '数据表标识',
|
// title: '数据表标识',
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
'x-component': 'Input',
|
// 'x-component': 'Input',
|
||||||
description: '使用英文',
|
// description: '使用英文',
|
||||||
} as ISchema,
|
// } as ISchema,
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
type: 'string',
|
type: 'string',
|
||||||
name: 'usingConfig',
|
name: 'usingConfig',
|
||||||
interface: 'input',
|
interface: 'input',
|
||||||
uiSchema: {
|
uiSchema: {
|
||||||
title: '权限策略',
|
title: '{{t("Permission policy")}}',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
'x-component': 'Select',
|
'x-component': 'Select',
|
||||||
enum: [
|
enum: [
|
||||||
{ label: '单独配置', value: 'resourceAction', color: 'orange' },
|
{ label: '{{t("Individual")}}', value: 'resourceAction', color: 'orange' },
|
||||||
{ label: '通用配置', value: 'strategy', color: 'default' },
|
{ label: '{{t("General")}}', value: 'strategy', color: 'default' },
|
||||||
],
|
],
|
||||||
} as ISchema,
|
} as ISchema,
|
||||||
},
|
},
|
||||||
@ -127,7 +127,7 @@ export const roleCollectionsSchema: ISchema = {
|
|||||||
},
|
},
|
||||||
column4: {
|
column4: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: 'Actions',
|
title: '{{t("Actions")}}',
|
||||||
'x-component': 'Table.Column',
|
'x-component': 'Table.Column',
|
||||||
properties: {
|
properties: {
|
||||||
actions: {
|
actions: {
|
||||||
@ -139,7 +139,7 @@ export const roleCollectionsSchema: ISchema = {
|
|||||||
properties: {
|
properties: {
|
||||||
configure: {
|
configure: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: '单独配置权限',
|
title: '{{t("Configure")}}',
|
||||||
'x-component': 'Action.Link',
|
'x-component': 'Action.Link',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
@ -152,15 +152,16 @@ export const roleCollectionsSchema: ISchema = {
|
|||||||
'x-decorator-props': {
|
'x-decorator-props': {
|
||||||
useValues: useRoleResourceValues,
|
useValues: useRoleResourceValues,
|
||||||
},
|
},
|
||||||
title: '配置权限',
|
title: '{{t("Configure permission")}}',
|
||||||
properties: {
|
properties: {
|
||||||
usingActionsConfig: {
|
usingActionsConfig: {
|
||||||
|
title: '{{t("Permission policy")}}',
|
||||||
'x-component': 'Radio.Group',
|
'x-component': 'Radio.Group',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
default: false,
|
default: false,
|
||||||
enum: [
|
enum: [
|
||||||
{ value: false, label: '使用通用权限' },
|
{ value: false, label: '{{t("General")}}' },
|
||||||
{ value: true, label: '单独配置权限' },
|
{ value: true, label: '{{t("Individual")}}' },
|
||||||
],
|
],
|
||||||
'x-reactions': {
|
'x-reactions': {
|
||||||
target: 'actions',
|
target: 'actions',
|
||||||
@ -179,15 +180,15 @@ export const roleCollectionsSchema: ISchema = {
|
|||||||
type: 'void',
|
type: 'void',
|
||||||
'x-component': 'Action.Drawer.Footer',
|
'x-component': 'Action.Drawer.Footer',
|
||||||
properties: {
|
properties: {
|
||||||
action1: {
|
cancel: {
|
||||||
title: 'Cancel',
|
title: '{{t("Cancel")}}',
|
||||||
'x-component': 'Action',
|
'x-component': 'Action',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
useAction: '{{ cm.useCancelAction }}',
|
useAction: '{{ cm.useCancelAction }}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
action2: {
|
submit: {
|
||||||
title: 'Submit',
|
title: '{{t("Submit")}}',
|
||||||
'x-component': 'Action',
|
'x-component': 'Action',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
|
@ -14,7 +14,7 @@ const collection = {
|
|||||||
name: 'title',
|
name: 'title',
|
||||||
interface: 'input',
|
interface: 'input',
|
||||||
uiSchema: {
|
uiSchema: {
|
||||||
title: '角色名称',
|
title: '{{t("Role title")}}',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
'x-component': 'Input',
|
'x-component': 'Input',
|
||||||
required: true,
|
required: true,
|
||||||
@ -25,7 +25,7 @@ const collection = {
|
|||||||
name: 'name',
|
name: 'name',
|
||||||
interface: 'input',
|
interface: 'input',
|
||||||
uiSchema: {
|
uiSchema: {
|
||||||
title: '角色标识',
|
title: '{{t("Role name")}}',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
'x-component': 'Input',
|
'x-component': 'Input',
|
||||||
} as ISchema,
|
} as ISchema,
|
||||||
@ -35,7 +35,7 @@ const collection = {
|
|||||||
name: 'default',
|
name: 'default',
|
||||||
interface: 'boolean',
|
interface: 'boolean',
|
||||||
uiSchema: {
|
uiSchema: {
|
||||||
title: '默认角色',
|
title: '{{t("Default role")}}',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
'x-component': 'Checkbox',
|
'x-component': 'Checkbox',
|
||||||
} as ISchema,
|
} as ISchema,
|
||||||
@ -82,12 +82,19 @@ export const roleSchema: ISchema = {
|
|||||||
properties: {
|
properties: {
|
||||||
delete: {
|
delete: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: '删除',
|
title: '{{ t("Delete") }}',
|
||||||
'x-component': 'Action',
|
'x-component': 'Action',
|
||||||
|
'x-component-props': {
|
||||||
|
useAction: '{{ cm.useBulkDestroyAction }}',
|
||||||
|
confirm: {
|
||||||
|
title: "{{t('Delete role')}}",
|
||||||
|
content: "{{t('Are you sure you want to delete it?')}}",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
create: {
|
create: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: '添加角色',
|
title: '{{t("Add role")}}',
|
||||||
'x-component': 'Action',
|
'x-component': 'Action',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
@ -111,7 +118,7 @@ export const roleSchema: ISchema = {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
title: '添加角色',
|
title: '{{t("Add role")}}',
|
||||||
properties: {
|
properties: {
|
||||||
title: {
|
title: {
|
||||||
'x-component': 'CollectionField',
|
'x-component': 'CollectionField',
|
||||||
@ -120,25 +127,28 @@ export const roleSchema: ISchema = {
|
|||||||
name: {
|
name: {
|
||||||
'x-component': 'CollectionField',
|
'x-component': 'CollectionField',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
description: '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}',
|
description:
|
||||||
|
'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}',
|
||||||
},
|
},
|
||||||
default: {
|
default: {
|
||||||
'x-component': 'CollectionField',
|
'x-component': 'CollectionField',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
|
title: '',
|
||||||
|
'x-content': '{{t("Default role")}}',
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
'x-component': 'Action.Drawer.Footer',
|
'x-component': 'Action.Drawer.Footer',
|
||||||
properties: {
|
properties: {
|
||||||
action1: {
|
cancel: {
|
||||||
title: 'Cancel',
|
title: '{{t("Cancel")}}',
|
||||||
'x-component': 'Action',
|
'x-component': 'Action',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
useAction: '{{ cm.useCancelAction }}',
|
useAction: '{{ cm.useCancelAction }}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
action2: {
|
submit: {
|
||||||
title: 'Submit',
|
title: '{{t("Submit")}}',
|
||||||
'x-component': 'Action',
|
'x-component': 'Action',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
@ -215,14 +225,14 @@ export const roleSchema: ISchema = {
|
|||||||
properties: {
|
properties: {
|
||||||
view: {
|
view: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: '配置权限',
|
title: '{{t("Configure")}}',
|
||||||
'x-component': 'Action.Link',
|
'x-component': 'Action.Link',
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
properties: {
|
properties: {
|
||||||
drawer: {
|
drawer: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
'x-component': 'Action.Drawer',
|
'x-component': 'Action.Drawer',
|
||||||
title: '配置权限',
|
title: '{{t("Configure permissions")}}',
|
||||||
properties: {
|
properties: {
|
||||||
tabs1: {
|
tabs1: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
@ -231,7 +241,7 @@ export const roleSchema: ISchema = {
|
|||||||
properties: {
|
properties: {
|
||||||
tab1: {
|
tab1: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: '系统全局配置',
|
title: '{{t("Global permissions")}}',
|
||||||
'x-component': 'Tabs.TabPane',
|
'x-component': 'Tabs.TabPane',
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
properties: {
|
properties: {
|
||||||
@ -242,7 +252,7 @@ export const roleSchema: ISchema = {
|
|||||||
},
|
},
|
||||||
tab2: {
|
tab2: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: '数据权限',
|
title: '{{t("Action permissions")}}',
|
||||||
'x-component': 'Tabs.TabPane',
|
'x-component': 'Tabs.TabPane',
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
properties: {
|
properties: {
|
||||||
@ -251,7 +261,7 @@ export const roleSchema: ISchema = {
|
|||||||
},
|
},
|
||||||
tab3: {
|
tab3: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: '菜单访问权限',
|
title: '{{t("Menu permissions")}}',
|
||||||
'x-component': 'Tabs.TabPane',
|
'x-component': 'Tabs.TabPane',
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
properties: {
|
properties: {
|
||||||
@ -268,7 +278,7 @@ export const roleSchema: ISchema = {
|
|||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: '编辑',
|
title: '{{t("Edit")}}',
|
||||||
'x-component': 'Action.Link',
|
'x-component': 'Action.Link',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
@ -281,7 +291,7 @@ export const roleSchema: ISchema = {
|
|||||||
'x-decorator-props': {
|
'x-decorator-props': {
|
||||||
useValues: '{{ cm.useValuesFromRecord }}',
|
useValues: '{{ cm.useValuesFromRecord }}',
|
||||||
},
|
},
|
||||||
title: '编辑角色',
|
title: '{{t("Edit role")}}',
|
||||||
properties: {
|
properties: {
|
||||||
title: {
|
title: {
|
||||||
'x-component': 'CollectionField',
|
'x-component': 'CollectionField',
|
||||||
@ -293,22 +303,24 @@ export const roleSchema: ISchema = {
|
|||||||
'x-disabled': true,
|
'x-disabled': true,
|
||||||
},
|
},
|
||||||
default: {
|
default: {
|
||||||
|
title: '',
|
||||||
'x-component': 'CollectionField',
|
'x-component': 'CollectionField',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
|
'x-content': '{{t("Default role")}}',
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
'x-component': 'Action.Drawer.Footer',
|
'x-component': 'Action.Drawer.Footer',
|
||||||
properties: {
|
properties: {
|
||||||
action1: {
|
cancel: {
|
||||||
title: 'Cancel',
|
title: '{{t("Cancel")}}',
|
||||||
'x-component': 'Action',
|
'x-component': 'Action',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
useAction: '{{ cm.useCancelAction }}',
|
useAction: '{{ cm.useCancelAction }}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
action2: {
|
submit: {
|
||||||
title: 'Submit',
|
title: '{{t("Submit")}}',
|
||||||
'x-component': 'Action',
|
'x-component': 'Action',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
@ -323,10 +335,14 @@ export const roleSchema: ISchema = {
|
|||||||
},
|
},
|
||||||
delete: {
|
delete: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: '删除',
|
title: '{{ t("Delete") }}',
|
||||||
'x-component': 'Action.Link',
|
'x-component': 'Action.Link',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
useAction: '{{ cm.useDestroyAction }}',
|
confirm: {
|
||||||
|
title: "{{t('Delete role')}}",
|
||||||
|
content: "{{t('Are you sure you want to delete it?')}}",
|
||||||
|
},
|
||||||
|
useAction: '{{cm.useDestroyAction}}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -12,7 +12,7 @@ export const rolesResourcesScopesCollection = {
|
|||||||
name: 'name',
|
name: 'name',
|
||||||
interface: 'input',
|
interface: 'input',
|
||||||
uiSchema: {
|
uiSchema: {
|
||||||
title: '名称',
|
title: '{{t("Scope name")}}',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
'x-component': 'Input',
|
'x-component': 'Input',
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -3,7 +3,7 @@ import { Modal } from 'antd';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { useCollection } from '../../collection-manager';
|
import { useCollection } from '../../collection-manager';
|
||||||
import { useActionContext } from '../../schema-component';
|
import { useActionContext, useCompile } from '../../schema-component';
|
||||||
import { useBlockRequestContext, useFilterByTk } from '../BlockProvider';
|
import { useBlockRequestContext, useFilterByTk } from '../BlockProvider';
|
||||||
import { useDetailsBlockContext } from '../DetailsBlockProvider';
|
import { useDetailsBlockContext } from '../DetailsBlockProvider';
|
||||||
import { TableFieldResource } from '../TableFieldProvider';
|
import { TableFieldResource } from '../TableFieldProvider';
|
||||||
@ -60,6 +60,7 @@ export const useCreateActionProps = () => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const actionSchema = useFieldSchema();
|
const actionSchema = useFieldSchema();
|
||||||
const { fields, getField } = useCollection();
|
const { fields, getField } = useCollection();
|
||||||
|
const compile = useCompile();
|
||||||
return {
|
return {
|
||||||
async onClick() {
|
async onClick() {
|
||||||
const fieldNames = fields.map((field) => field.name);
|
const fieldNames = fields.map((field) => field.name);
|
||||||
@ -112,7 +113,7 @@ export const useCreateActionProps = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Modal.success({
|
Modal.success({
|
||||||
title: onSuccess?.successMessage,
|
title: compile(onSuccess?.successMessage),
|
||||||
onOk: async () => {
|
onOk: async () => {
|
||||||
await form.reset();
|
await form.reset();
|
||||||
if (onSuccess?.redirecting && onSuccess?.redirectTo) {
|
if (onSuccess?.redirecting && onSuccess?.redirectTo) {
|
||||||
@ -136,6 +137,7 @@ export const useUpdateActionProps = () => {
|
|||||||
const actionSchema = useFieldSchema();
|
const actionSchema = useFieldSchema();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const { fields, getField } = useCollection();
|
const { fields, getField } = useCollection();
|
||||||
|
const compile = useCompile();
|
||||||
return {
|
return {
|
||||||
async onClick() {
|
async onClick() {
|
||||||
const skipValidator = actionSchema?.['x-action-settings']?.skipValidator;
|
const skipValidator = actionSchema?.['x-action-settings']?.skipValidator;
|
||||||
@ -197,7 +199,7 @@ export const useUpdateActionProps = () => {
|
|||||||
const onSuccess = actionSchema?.['x-action-settings']?.onSuccess;
|
const onSuccess = actionSchema?.['x-action-settings']?.onSuccess;
|
||||||
if (onSuccess?.successMessage) {
|
if (onSuccess?.successMessage) {
|
||||||
Modal.success({
|
Modal.success({
|
||||||
title: onSuccess?.successMessage,
|
title: compile(onSuccess?.successMessage),
|
||||||
onOk: async () => {
|
onOk: async () => {
|
||||||
await form.reset();
|
await form.reset();
|
||||||
if (onSuccess?.redirecting && onSuccess?.redirectTo) {
|
if (onSuccess?.redirecting && onSuccess?.redirectTo) {
|
||||||
|
@ -78,10 +78,10 @@ export const chinaRegion: IField = {
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: 'name',
|
name: 'name',
|
||||||
title: '名称',
|
title: '{{t("Filename")}}',
|
||||||
operators: operators.string,
|
operators: operators.string,
|
||||||
schema: {
|
schema: {
|
||||||
title: '名称',
|
title: '{{t("Filename")}}',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
'x-component': 'Input',
|
'x-component': 'Input',
|
||||||
},
|
},
|
||||||
|
@ -288,5 +288,8 @@ export default {
|
|||||||
"Block type": "区块类型",
|
"Block type": "区块类型",
|
||||||
"Action column": "操作列",
|
"Action column": "操作列",
|
||||||
"Records per page": "每页显示数量",
|
"Records per page": "每页显示数量",
|
||||||
"(Fields only)": "(仅字段)"
|
"(Fields only)": "(仅字段)",
|
||||||
|
"Button title": "按钮标题",
|
||||||
|
"Button icon": "按钮图标",
|
||||||
|
"Submitted successfully": "提交成功",
|
||||||
}
|
}
|
||||||
|
@ -13,16 +13,16 @@ export const ActionDesigner = (props) => {
|
|||||||
return (
|
return (
|
||||||
<GeneralSchemaDesigner {...props}>
|
<GeneralSchemaDesigner {...props}>
|
||||||
<SchemaSettings.ModalItem
|
<SchemaSettings.ModalItem
|
||||||
title={'编辑'}
|
title={t('Edit button')}
|
||||||
schema={
|
schema={
|
||||||
{
|
{
|
||||||
type: 'object',
|
type: 'object',
|
||||||
title: '编辑按钮',
|
title: t('Edit button'),
|
||||||
properties: {
|
properties: {
|
||||||
title: {
|
title: {
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component': 'Input',
|
'x-component': 'Input',
|
||||||
title: '按钮标题',
|
title: t('Button title'),
|
||||||
default: fieldSchema.title,
|
default: fieldSchema.title,
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
// description: `原字段标题:${collectionField?.uiSchema?.title}`,
|
// description: `原字段标题:${collectionField?.uiSchema?.title}`,
|
||||||
@ -30,7 +30,7 @@ export const ActionDesigner = (props) => {
|
|||||||
icon: {
|
icon: {
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component': 'IconPicker',
|
'x-component': 'IconPicker',
|
||||||
title: '按钮图标',
|
title: t('Button icon'),
|
||||||
default: fieldSchema?.['x-component-props']?.icon,
|
default: fieldSchema?.['x-component-props']?.icon,
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
// description: `原字段标题:${collectionField?.uiSchema?.title}`,
|
// description: `原字段标题:${collectionField?.uiSchema?.title}`,
|
||||||
@ -60,10 +60,10 @@ export const ActionDesigner = (props) => {
|
|||||||
/>
|
/>
|
||||||
{isPopupAction && (
|
{isPopupAction && (
|
||||||
<SchemaSettings.SelectItem
|
<SchemaSettings.SelectItem
|
||||||
title={'打开方式'}
|
title={t('Open mode')}
|
||||||
options={[
|
options={[
|
||||||
{ label: '抽屉', value: 'drawer' },
|
{ label: t('Drawer'), value: 'drawer' },
|
||||||
{ label: '对话框', value: 'modal' },
|
{ label: t('Dialog'), value: 'modal' },
|
||||||
]}
|
]}
|
||||||
value={field.componentProps.openMode}
|
value={field.componentProps.openMode}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
@ -81,7 +81,7 @@ export const ActionDesigner = (props) => {
|
|||||||
)}
|
)}
|
||||||
{fieldSchema?.['x-action-settings'] && (
|
{fieldSchema?.['x-action-settings'] && (
|
||||||
<SchemaSettings.SwitchItem
|
<SchemaSettings.SwitchItem
|
||||||
title={'跳过必填校验'}
|
title={t('Skip required validation')}
|
||||||
checked={!!fieldSchema?.['x-action-settings']?.skipValidator}
|
checked={!!fieldSchema?.['x-action-settings']?.skipValidator}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
fieldSchema['x-action-settings'].skipValidator = value;
|
fieldSchema['x-action-settings'].skipValidator = value;
|
||||||
@ -98,13 +98,13 @@ export const ActionDesigner = (props) => {
|
|||||||
)}
|
)}
|
||||||
{fieldSchema?.['x-action-settings'] && (
|
{fieldSchema?.['x-action-settings'] && (
|
||||||
<SchemaSettings.ModalItem
|
<SchemaSettings.ModalItem
|
||||||
title={'表单值'}
|
title={t('Form values')}
|
||||||
schema={
|
schema={
|
||||||
{
|
{
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
overwriteValues: {
|
overwriteValues: {
|
||||||
title: '以下字段提交时,保存值为',
|
title: t('When submitting the following fields, the saved values are'),
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component': 'Input.TextArea',
|
'x-component': 'Input.TextArea',
|
||||||
default: JSON.stringify(fieldSchema?.['x-action-settings']?.overwriteValues),
|
default: JSON.stringify(fieldSchema?.['x-action-settings']?.overwriteValues),
|
||||||
@ -190,6 +190,9 @@ export const ActionDesigner = (props) => {
|
|||||||
breakRemoveOn={(s) => {
|
breakRemoveOn={(s) => {
|
||||||
return s['x-component'] === 'Space' || s['x-component'].endsWith('ActionBar');
|
return s['x-component'] === 'Space' || s['x-component'].endsWith('ActionBar');
|
||||||
}}
|
}}
|
||||||
|
confirm={{
|
||||||
|
title: t('Delete action')
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</GeneralSchemaDesigner>
|
</GeneralSchemaDesigner>
|
||||||
);
|
);
|
||||||
|
@ -13,7 +13,6 @@ export const BlockItem: React.FC<any> = (props) => {
|
|||||||
props.className,
|
props.className,
|
||||||
css`
|
css`
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
|
||||||
&:hover {
|
&:hover {
|
||||||
> .general-schema-designer {
|
> .general-schema-designer {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -65,27 +65,25 @@ export const FilterActionDesigner = (props) => {
|
|||||||
</SchemaSettings.ItemGroup>
|
</SchemaSettings.ItemGroup>
|
||||||
<SchemaSettings.Divider />
|
<SchemaSettings.Divider />
|
||||||
<SchemaSettings.ModalItem
|
<SchemaSettings.ModalItem
|
||||||
title={'编辑'}
|
title={t('Edit button')}
|
||||||
schema={
|
schema={
|
||||||
{
|
{
|
||||||
type: 'object',
|
type: 'object',
|
||||||
title: '编辑按钮',
|
title: t('Edit button'),
|
||||||
properties: {
|
properties: {
|
||||||
title: {
|
title: {
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component': 'Input',
|
'x-component': 'Input',
|
||||||
title: '按钮标题',
|
title: t('Button title'),
|
||||||
default: fieldSchema.title,
|
default: fieldSchema.title,
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
// description: `原字段标题:${collectionField?.uiSchema?.title}`,
|
|
||||||
},
|
},
|
||||||
icon: {
|
icon: {
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component': 'IconPicker',
|
'x-component': 'IconPicker',
|
||||||
title: '按钮图标',
|
title: t('Button icon'),
|
||||||
default: fieldSchema?.['x-component-props']?.icon,
|
default: fieldSchema?.['x-component-props']?.icon,
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
// description: `原字段标题:${collectionField?.uiSchema?.title}`,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} as ISchema
|
} as ISchema
|
||||||
|
@ -174,7 +174,7 @@ FormItem.Designer = () => {
|
|||||||
)}
|
)}
|
||||||
{collectionField?.target && (
|
{collectionField?.target && (
|
||||||
<SchemaSettings.SelectItem
|
<SchemaSettings.SelectItem
|
||||||
title={'标题字段'}
|
title={t('Title field')}
|
||||||
options={options}
|
options={options}
|
||||||
value={field?.componentProps?.fieldNames?.label}
|
value={field?.componentProps?.fieldNames?.label}
|
||||||
onChange={(label) => {
|
onChange={(label) => {
|
||||||
@ -201,6 +201,9 @@ FormItem.Designer = () => {
|
|||||||
{collectionField && <SchemaSettings.Divider />}
|
{collectionField && <SchemaSettings.Divider />}
|
||||||
<SchemaSettings.Remove
|
<SchemaSettings.Remove
|
||||||
removeParentsIfNoChildren
|
removeParentsIfNoChildren
|
||||||
|
confirm={{
|
||||||
|
title: t('Delete field')
|
||||||
|
}}
|
||||||
breakRemoveOn={{
|
breakRemoveOn={{
|
||||||
'x-component': 'Grid',
|
'x-component': 'Grid',
|
||||||
}}
|
}}
|
||||||
|
@ -80,6 +80,7 @@ export const KanbanCardDesigner = (props: any) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const dn = createDesignable({
|
const dn = createDesignable({
|
||||||
|
t,
|
||||||
api,
|
api,
|
||||||
refresh,
|
refresh,
|
||||||
current: gridSchema,
|
current: gridSchema,
|
||||||
|
@ -79,6 +79,7 @@ export const KanbanCardDesigner = (props: any) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const dn = createDesignable({
|
const dn = createDesignable({
|
||||||
|
t,
|
||||||
api,
|
api,
|
||||||
refresh,
|
refresh,
|
||||||
current: gridSchema,
|
current: gridSchema,
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
import { useField } from '@formily/react';
|
import { useField } from '@formily/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
|
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
|
||||||
|
|
||||||
export const MarkdownVoidDesigner = () => {
|
export const MarkdownVoidDesigner = () => {
|
||||||
const field = useField();
|
const field = useField();
|
||||||
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<GeneralSchemaDesigner>
|
<GeneralSchemaDesigner>
|
||||||
<SchemaSettings.Item
|
<SchemaSettings.Item
|
||||||
title={'编辑'}
|
title={t('Edit markdown')}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
field.editable = true;
|
field.editable = true;
|
||||||
}}
|
}}
|
||||||
|
@ -308,6 +308,7 @@ export const MenuDesigner = () => {
|
|||||||
}
|
}
|
||||||
const current = findByUid(menuSchema, uid);
|
const current = findByUid(menuSchema, uid);
|
||||||
const dn = createDesignable({
|
const dn = createDesignable({
|
||||||
|
t,
|
||||||
api,
|
api,
|
||||||
refresh,
|
refresh,
|
||||||
current,
|
current,
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
import { Menu as AntdMenu } from 'antd';
|
import { Menu as AntdMenu } from 'antd';
|
||||||
import React, { createContext, useContext, useEffect, useState } from 'react';
|
import React, { createContext, useContext, useEffect, useState } from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { createDesignable, DndContext, SortableItem, useDesignable, useDesigner } from '../..';
|
import { createDesignable, DndContext, SortableItem, useDesignable, useDesigner } from '../..';
|
||||||
import { Icon, useAPIClient, useSchemaInitializer } from '../../../';
|
import { Icon, useAPIClient, useSchemaInitializer } from '../../../';
|
||||||
import { MenuDesigner } from './Menu.Designer';
|
import { MenuDesigner } from './Menu.Designer';
|
||||||
@ -144,6 +145,7 @@ export const Menu: ComposedMenu = observer((props) => {
|
|||||||
defaultOpenKeys: dOpenKeys,
|
defaultOpenKeys: dOpenKeys,
|
||||||
...others
|
...others
|
||||||
} = props;
|
} = props;
|
||||||
|
const { t } = useTranslation();
|
||||||
const Designer = useDesigner();
|
const Designer = useDesigner();
|
||||||
const schema = useFieldSchema();
|
const schema = useFieldSchema();
|
||||||
const { refresh } = useDesignable();
|
const { refresh } = useDesignable();
|
||||||
@ -300,8 +302,8 @@ export const Menu: ComposedMenu = observer((props) => {
|
|||||||
{render({
|
{render({
|
||||||
style: { margin: 8 },
|
style: { margin: 8 },
|
||||||
insert: (s) => {
|
insert: (s) => {
|
||||||
console.log('createDesignable', s);
|
|
||||||
const dn = createDesignable({
|
const dn = createDesignable({
|
||||||
|
t,
|
||||||
api,
|
api,
|
||||||
refresh,
|
refresh,
|
||||||
current: sideMenuSchema,
|
current: sideMenuSchema,
|
||||||
|
@ -34,16 +34,16 @@ export const TableColumnDesigner = (props) => {
|
|||||||
return (
|
return (
|
||||||
<GeneralSchemaDesigner>
|
<GeneralSchemaDesigner>
|
||||||
<SchemaSettings.ModalItem
|
<SchemaSettings.ModalItem
|
||||||
title={t('Edit column title')}
|
title={t('Custom column title')}
|
||||||
schema={
|
schema={
|
||||||
{
|
{
|
||||||
type: 'object',
|
type: 'object',
|
||||||
title: t('Edit column title'),
|
title: t('Custom column title'),
|
||||||
properties: {
|
properties: {
|
||||||
title: {
|
title: {
|
||||||
title: t('Column title'),
|
// title: t('Column title'),
|
||||||
default: columnSchema?.title,
|
default: columnSchema?.title,
|
||||||
description: `${t('Original field title: ')}${collectionField?.uiSchema?.title}`,
|
description: `${t('Original title: ')}${collectionField?.uiSchema?.title}`,
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component': 'Input',
|
'x-component': 'Input',
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
@ -97,6 +97,9 @@ export const TableColumnDesigner = (props) => {
|
|||||||
breakRemoveOn={{
|
breakRemoveOn={{
|
||||||
'x-component': 'Grid',
|
'x-component': 'Grid',
|
||||||
}}
|
}}
|
||||||
|
confirm={{
|
||||||
|
title: t('Delete table column')
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</GeneralSchemaDesigner>
|
</GeneralSchemaDesigner>
|
||||||
);
|
);
|
||||||
|
@ -2,12 +2,14 @@ import { DndContext as DndKitContext, DragEndEvent, DragOverlay, rectIntersectio
|
|||||||
import { Props } from '@dnd-kit/core/dist/components/DndContext/DndContext';
|
import { Props } from '@dnd-kit/core/dist/components/DndContext/DndContext';
|
||||||
import { observer } from '@formily/react';
|
import { observer } from '@formily/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useAPIClient } from '../../../';
|
import { useAPIClient } from '../../../';
|
||||||
import { createDesignable, useDesignable } from '../../hooks';
|
import { createDesignable, useDesignable } from '../../hooks';
|
||||||
|
|
||||||
const useDragEnd = (props?: any) => {
|
const useDragEnd = (props?: any) => {
|
||||||
const { refresh } = useDesignable();
|
const { refresh } = useDesignable();
|
||||||
const api = useAPIClient();
|
const api = useAPIClient();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (event: DragEndEvent) => {
|
return (event: DragEndEvent) => {
|
||||||
const { active, over } = event;
|
const { active, over } = event;
|
||||||
@ -28,6 +30,7 @@ const useDragEnd = (props?: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dn = createDesignable({
|
const dn = createDesignable({
|
||||||
|
t,
|
||||||
api,
|
api,
|
||||||
refresh,
|
refresh,
|
||||||
current: overSchema,
|
current: overSchema,
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { HighlightOutlined } from '@ant-design/icons';
|
import { HighlightOutlined } from '@ant-design/icons';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useDesignable } from '..';
|
import { useDesignable } from '..';
|
||||||
import { PluginManager } from '../../plugin-manager';
|
import { PluginManager } from '../../plugin-manager';
|
||||||
|
|
||||||
export const DesignableSwitch = () => {
|
export const DesignableSwitch = () => {
|
||||||
const { designable, setDesignable } = useDesignable();
|
const { designable, setDesignable } = useDesignable();
|
||||||
|
const { t } = useTranslation();
|
||||||
const style = {};
|
const style = {};
|
||||||
if (designable) {
|
if (designable) {
|
||||||
style['backgroundColor'] = '#f18b62';
|
style['backgroundColor'] = '#f18b62';
|
||||||
@ -13,7 +15,7 @@ export const DesignableSwitch = () => {
|
|||||||
<PluginManager.Toolbar.Item
|
<PluginManager.Toolbar.Item
|
||||||
selected={designable}
|
selected={designable}
|
||||||
icon={<HighlightOutlined />}
|
icon={<HighlightOutlined />}
|
||||||
title={'界面配置'}
|
title={t('UI Editor')}
|
||||||
style={style}
|
style={style}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setDesignable(!designable);
|
setDesignable(!designable);
|
||||||
|
@ -4,6 +4,7 @@ import { message } from 'antd';
|
|||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import set from 'lodash/set';
|
import set from 'lodash/set';
|
||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { APIClient, useAPIClient } from '../../api-client';
|
import { APIClient, useAPIClient } from '../../api-client';
|
||||||
import { SchemaComponentContext } from '../context';
|
import { SchemaComponentContext } from '../context';
|
||||||
|
|
||||||
@ -12,6 +13,8 @@ interface CreateDesignableProps {
|
|||||||
api?: APIClient;
|
api?: APIClient;
|
||||||
refresh?: () => void;
|
refresh?: () => void;
|
||||||
onSuccess?: any;
|
onSuccess?: any;
|
||||||
|
i18n?: any;
|
||||||
|
t?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createDesignable(options: CreateDesignableProps) {
|
export function createDesignable(options: CreateDesignableProps) {
|
||||||
@ -90,6 +93,8 @@ export const splitWrapSchema = (wrapped: Schema, schema: ISchema) => {
|
|||||||
return [schema1, schema2];
|
return [schema1, schema2];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const translate = (v?: any) => v;
|
||||||
|
|
||||||
export class Designable {
|
export class Designable {
|
||||||
current: Schema;
|
current: Schema;
|
||||||
options: CreateDesignableProps;
|
options: CreateDesignableProps;
|
||||||
@ -101,7 +106,7 @@ export class Designable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadAPIClientEvents() {
|
loadAPIClientEvents() {
|
||||||
const { refresh, api } = this.options;
|
const { refresh, api, t = translate } = this.options;
|
||||||
if (!api) {
|
if (!api) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -125,7 +130,7 @@ export class Designable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
onSuccess?.();
|
onSuccess?.();
|
||||||
message.success('配置保存成功!', 0.2);
|
message.success(t('Saved successfully'), 0.2);
|
||||||
});
|
});
|
||||||
this.on('patch', async ({ schema }) => {
|
this.on('patch', async ({ schema }) => {
|
||||||
refresh();
|
refresh();
|
||||||
@ -139,7 +144,7 @@ export class Designable {
|
|||||||
...schema,
|
...schema,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
message.success('配置保存成功!', 0.2);
|
message.success(t('Saved successfully'), 0.2);
|
||||||
});
|
});
|
||||||
this.on('remove', async ({ removed }) => {
|
this.on('remove', async ({ removed }) => {
|
||||||
refresh();
|
refresh();
|
||||||
@ -150,7 +155,7 @@ export class Designable {
|
|||||||
url: `/uiSchemas:remove/${removed['x-uid']}`,
|
url: `/uiSchemas:remove/${removed['x-uid']}`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
});
|
});
|
||||||
message.success('配置保存成功!', 0.2);
|
message.success(t('Saved successfully'), 0.2);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,7 +513,8 @@ export function useDesignable() {
|
|||||||
const field = useField();
|
const field = useField();
|
||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
const api = useAPIClient();
|
const api = useAPIClient();
|
||||||
const dn = createDesignable({ api, refresh, current: fieldSchema });
|
const { t } = useTranslation();
|
||||||
|
const dn = createDesignable({ t, api, refresh, current: fieldSchema });
|
||||||
dn.loadAPIClientEvents();
|
dn.loadAPIClientEvents();
|
||||||
return {
|
return {
|
||||||
dn,
|
dn,
|
||||||
|
@ -14,42 +14,42 @@ export const BlockInitializers = {
|
|||||||
{
|
{
|
||||||
key: 'table',
|
key: 'table',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Table',
|
title: '{{t("Table")}}',
|
||||||
component: 'TableBlockInitializer',
|
component: 'TableBlockInitializer',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'form',
|
key: 'form',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Form',
|
title: '{{t("Form")}}',
|
||||||
component: 'FormBlockInitializer',
|
component: 'FormBlockInitializer',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'details',
|
key: 'details',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Details',
|
title: '{{t("Details")}}',
|
||||||
component: 'DetailsBlockInitializer',
|
component: 'DetailsBlockInitializer',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'calendar',
|
key: 'calendar',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Calendar',
|
title: '{{t("Calendar")}}',
|
||||||
component: 'CalendarBlockInitializer',
|
component: 'CalendarBlockInitializer',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'kanban',
|
key: 'kanban',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Kanban',
|
title: '{{t("Kanban")}}',
|
||||||
component: 'KanbanBlockInitializer',
|
component: 'KanbanBlockInitializer',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: 'Media',
|
title: '{{t("Media")}}',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Markdown',
|
title: '{{t("Markdown")}}',
|
||||||
component: 'MarkdownBlockInitializer',
|
component: 'MarkdownBlockInitializer',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
// 日历的操作配置
|
// 日历的操作配置
|
||||||
export const CalendarActionInitializers = {
|
export const CalendarActionInitializers = {
|
||||||
title: 'Configure actions',
|
title: '{{t("Configure actions")}}',
|
||||||
icon: 'SettingOutlined',
|
icon: 'SettingOutlined',
|
||||||
style: { marginLeft: 8 },
|
style: { marginLeft: 8 },
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: 'Enable actions',
|
title: '{{t("Enable actions")}}',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Today',
|
title: '{{t("Today")}}',
|
||||||
component: 'ActionInitializer',
|
component: 'ActionInitializer',
|
||||||
schema: {
|
schema: {
|
||||||
title: 'Today',
|
title: '{{t("Today")}}',
|
||||||
'x-component': 'CalendarV2.Today',
|
'x-component': 'CalendarV2.Today',
|
||||||
'x-action': `calendar:today`,
|
'x-action': `calendar:today`,
|
||||||
'x-align': 'left',
|
'x-align': 'left',
|
||||||
@ -21,10 +21,10 @@ export const CalendarActionInitializers = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Turn pages',
|
title: '{{t("Turn pages")}}',
|
||||||
component: 'ActionInitializer',
|
component: 'ActionInitializer',
|
||||||
schema: {
|
schema: {
|
||||||
title: 'Turn pages',
|
title: '{{t("Turn pages")}}',
|
||||||
'x-component': 'CalendarV2.Nav',
|
'x-component': 'CalendarV2.Nav',
|
||||||
'x-action': `calendar:nav`,
|
'x-action': `calendar:nav`,
|
||||||
'x-align': 'left',
|
'x-align': 'left',
|
||||||
@ -32,10 +32,10 @@ export const CalendarActionInitializers = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Title',
|
title: '{{t("Title")}}',
|
||||||
component: 'ActionInitializer',
|
component: 'ActionInitializer',
|
||||||
schema: {
|
schema: {
|
||||||
title: 'Title',
|
title: '{{t("Title")}}',
|
||||||
'x-component': 'CalendarV2.Title',
|
'x-component': 'CalendarV2.Title',
|
||||||
'x-action': `calendar:title`,
|
'x-action': `calendar:title`,
|
||||||
'x-align': 'left',
|
'x-align': 'left',
|
||||||
@ -43,10 +43,10 @@ export const CalendarActionInitializers = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Select view',
|
title: '{{t("Select view")}}',
|
||||||
component: 'ActionInitializer',
|
component: 'ActionInitializer',
|
||||||
schema: {
|
schema: {
|
||||||
title: 'Select view',
|
title: '{{t("Select view")}}',
|
||||||
'x-component': 'CalendarV2.ViewSelect',
|
'x-component': 'CalendarV2.ViewSelect',
|
||||||
'x-action': `calendar:viewSelect`,
|
'x-action': `calendar:viewSelect`,
|
||||||
'x-align': 'right',
|
'x-align': 'right',
|
||||||
|
@ -13,22 +13,22 @@ export const CreateFormBlockInitializers = (props: any) => {
|
|||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: '{{ t("Data blocks") }}',
|
title: '{{t("Data blocks")}}',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: '{{ t("Form") }}',
|
title: '{{t("Form")}}',
|
||||||
component: 'CreateFormBlockInitializer',
|
component: 'CreateFormBlockInitializer',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: 'Media',
|
title: '{{t("Media")}}',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Markdown',
|
title: '{{t("Markdown")}}',
|
||||||
component: 'MarkdownBlockInitializer',
|
component: 'MarkdownBlockInitializer',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
// 表单的操作配置
|
// 表单的操作配置
|
||||||
export const FormActionInitializers = {
|
export const FormActionInitializers = {
|
||||||
title: '{{t("Configure actions")}}',
|
title: '{{t("Configure actions")}}',
|
||||||
@ -15,7 +16,7 @@ export const FormActionInitializers = {
|
|||||||
'x-action-settings': {
|
'x-action-settings': {
|
||||||
initialValues: {},
|
initialValues: {},
|
||||||
onSuccess: {
|
onSuccess: {
|
||||||
successMessage: 'Submitted successfully!',
|
successMessage: '{{t("Submitted successfully")}}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -40,7 +41,7 @@ export const FormActionInitializers = {
|
|||||||
'x-action-settings': {
|
'x-action-settings': {
|
||||||
initialValues: {},
|
initialValues: {},
|
||||||
onSuccess: {
|
onSuccess: {
|
||||||
successMessage: 'Submitted successfully!',
|
successMessage: '{{t("Submitted successfully")}}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
|
@ -28,35 +28,35 @@ export const RecordBlockInitializers = (props: any) => {
|
|||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: '当前数据区块',
|
title: '{{t("Current record blocks")}}',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
key: 'details',
|
key: 'details',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Details',
|
title: '{{t("Details")}}',
|
||||||
component: 'RecordReadPrettyFormBlockInitializer',
|
component: 'RecordReadPrettyFormBlockInitializer',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'form',
|
key: 'form',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Form',
|
title: '{{t("Form")}}',
|
||||||
component: 'RecordFormBlockInitializer',
|
component: 'RecordFormBlockInitializer',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: '关系数据区块',
|
title: '{{t("Relationship blocks")}}',
|
||||||
children: useRelationFields(),
|
children: useRelationFields(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: 'Media',
|
title: '{{t("Media")}}',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
key: 'markdown',
|
key: 'markdown',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Markdown',
|
title: '{{t("Markdown")}}',
|
||||||
component: 'MarkdownBlockInitializer',
|
component: 'MarkdownBlockInitializer',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -24,11 +24,11 @@ export const RecordFormBlockInitializers = (props: any) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: 'Media',
|
title: '{{t("Media")}}',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: 'Markdown',
|
title: '{{t("Markdown")}}',
|
||||||
component: 'MarkdownBlockInitializer',
|
component: 'MarkdownBlockInitializer',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -25,6 +25,7 @@ export const TableActionColumnInitializers = (props: any) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const dn = createDesignable({
|
const dn = createDesignable({
|
||||||
|
t,
|
||||||
api,
|
api,
|
||||||
refresh,
|
refresh,
|
||||||
current: spaceSchema,
|
current: spaceSchema,
|
||||||
|
@ -25,7 +25,7 @@ export const TableSelectorInitializers = (props: any) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: 'Media',
|
title: t('Media'),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
|
@ -145,6 +145,7 @@ export const DetailsBlockInitializer = (props) => {
|
|||||||
|
|
||||||
export const CalendarBlockInitializer = (props) => {
|
export const CalendarBlockInitializer = (props) => {
|
||||||
const { insert } = props;
|
const { insert } = props;
|
||||||
|
const { t } = useTranslation();
|
||||||
const { getCollection } = useCollectionManager();
|
const { getCollection } = useCollectionManager();
|
||||||
const options = useContext(SchemaOptionsContext);
|
const options = useContext(SchemaOptionsContext);
|
||||||
return (
|
return (
|
||||||
@ -170,7 +171,7 @@ export const CalendarBlockInitializer = (props) => {
|
|||||||
value: field.name,
|
value: field.name,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const values = await FormDialog('创建日历区块', () => {
|
const values = await FormDialog(t('Create calendar block'), () => {
|
||||||
return (
|
return (
|
||||||
<SchemaComponentOptions scope={options.scope} components={{ ...options.components }}>
|
<SchemaComponentOptions scope={options.scope} components={{ ...options.components }}>
|
||||||
<FormLayout layout={'vertical'}>
|
<FormLayout layout={'vertical'}>
|
||||||
@ -178,14 +179,14 @@ export const CalendarBlockInitializer = (props) => {
|
|||||||
schema={{
|
schema={{
|
||||||
properties: {
|
properties: {
|
||||||
title: {
|
title: {
|
||||||
title: '标题字段',
|
title: t('Title field'),
|
||||||
enum: stringFields,
|
enum: stringFields,
|
||||||
required: true,
|
required: true,
|
||||||
'x-component': 'Select',
|
'x-component': 'Select',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
},
|
},
|
||||||
start: {
|
start: {
|
||||||
title: '开始日期字段',
|
title: t('Start date field'),
|
||||||
enum: dateFields,
|
enum: dateFields,
|
||||||
required: true,
|
required: true,
|
||||||
default: 'createdAt',
|
default: 'createdAt',
|
||||||
@ -193,7 +194,7 @@ export const CalendarBlockInitializer = (props) => {
|
|||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
},
|
},
|
||||||
end: {
|
end: {
|
||||||
title: '结束日期字段',
|
title: t('End date field'),
|
||||||
enum: dateFields,
|
enum: dateFields,
|
||||||
'x-component': 'Select',
|
'x-component': 'Select',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
@ -222,6 +223,7 @@ export const CalendarBlockInitializer = (props) => {
|
|||||||
|
|
||||||
export const KanbanBlockInitializer = (props) => {
|
export const KanbanBlockInitializer = (props) => {
|
||||||
const { insert } = props;
|
const { insert } = props;
|
||||||
|
const { t } = useTranslation();
|
||||||
const { getCollection } = useCollectionManager();
|
const { getCollection } = useCollectionManager();
|
||||||
const options = useContext(SchemaOptionsContext);
|
const options = useContext(SchemaOptionsContext);
|
||||||
const api = useAPIClient();
|
const api = useAPIClient();
|
||||||
@ -244,7 +246,7 @@ export const KanbanBlockInitializer = (props) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const values = await FormDialog('创建看板区块', () => {
|
const values = await FormDialog(t('Create kanban block'), () => {
|
||||||
return (
|
return (
|
||||||
<SchemaComponentOptions scope={options.scope} components={{ ...options.components }}>
|
<SchemaComponentOptions scope={options.scope} components={{ ...options.components }}>
|
||||||
<FormLayout layout={'vertical'}>
|
<FormLayout layout={'vertical'}>
|
||||||
@ -252,7 +254,7 @@ export const KanbanBlockInitializer = (props) => {
|
|||||||
schema={{
|
schema={{
|
||||||
properties: {
|
properties: {
|
||||||
groupField: {
|
groupField: {
|
||||||
title: '分组字段',
|
title: t('Group field'),
|
||||||
enum: fields,
|
enum: fields,
|
||||||
required: true,
|
required: true,
|
||||||
'x-component': 'Select',
|
'x-component': 'Select',
|
||||||
|
@ -164,7 +164,7 @@ export const useRecordCollectionDataSourceItems = (componentName) => {
|
|||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
name: collection.name,
|
name: collection.name,
|
||||||
title: '空白区块',
|
title: t('Blank block'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'divider',
|
type: 'divider',
|
||||||
@ -173,7 +173,7 @@ export const useRecordCollectionDataSourceItems = (componentName) => {
|
|||||||
key: `${componentName}_table_subMenu_${index}_copy`,
|
key: `${componentName}_table_subMenu_${index}_copy`,
|
||||||
type: 'subMenu',
|
type: 'subMenu',
|
||||||
name: 'copy',
|
name: 'copy',
|
||||||
title: '复制模板',
|
title: t('Duplicate template'),
|
||||||
children: templates.map((template) => {
|
children: templates.map((template) => {
|
||||||
const templateName =
|
const templateName =
|
||||||
template?.componentName === 'ReadPrettyFormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name;
|
template?.componentName === 'ReadPrettyFormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name;
|
||||||
@ -182,7 +182,7 @@ export const useRecordCollectionDataSourceItems = (componentName) => {
|
|||||||
mode: 'copy',
|
mode: 'copy',
|
||||||
name: collection.name,
|
name: collection.name,
|
||||||
template,
|
template,
|
||||||
title: templateName || '未命名',
|
title: templateName || t('Untitled'),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@ -190,7 +190,7 @@ export const useRecordCollectionDataSourceItems = (componentName) => {
|
|||||||
key: `${componentName}_table_subMenu_${index}_ref`,
|
key: `${componentName}_table_subMenu_${index}_ref`,
|
||||||
type: 'subMenu',
|
type: 'subMenu',
|
||||||
name: 'ref',
|
name: 'ref',
|
||||||
title: '引用模板',
|
title: t('Reference template'),
|
||||||
children: templates.map((template) => {
|
children: templates.map((template) => {
|
||||||
const templateName =
|
const templateName =
|
||||||
template?.componentName === 'ReadPrettyFormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name;
|
template?.componentName === 'ReadPrettyFormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name;
|
||||||
@ -199,7 +199,7 @@ export const useRecordCollectionDataSourceItems = (componentName) => {
|
|||||||
mode: 'reference',
|
mode: 'reference',
|
||||||
name: collection.name,
|
name: collection.name,
|
||||||
template,
|
template,
|
||||||
title: templateName || '未命名',
|
title: templateName || t('Untitled'),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@ -214,7 +214,7 @@ export const useCollectionDataSourceItems = (componentName) => {
|
|||||||
{
|
{
|
||||||
key: 'tableBlock',
|
key: 'tableBlock',
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: t('Select data source'),
|
title: t('Select collection'),
|
||||||
children: collections
|
children: collections
|
||||||
?.filter((item) => !item.inherit)
|
?.filter((item) => !item.inherit)
|
||||||
?.map((item, index) => {
|
?.map((item, index) => {
|
||||||
@ -237,7 +237,7 @@ export const useCollectionDataSourceItems = (componentName) => {
|
|||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
name: item.name,
|
name: item.name,
|
||||||
title: '空白区块',
|
title: t('Blank block'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'divider',
|
type: 'divider',
|
||||||
@ -246,7 +246,7 @@ export const useCollectionDataSourceItems = (componentName) => {
|
|||||||
key: `${componentName}_table_subMenu_${index}_copy`,
|
key: `${componentName}_table_subMenu_${index}_copy`,
|
||||||
type: 'subMenu',
|
type: 'subMenu',
|
||||||
name: 'copy',
|
name: 'copy',
|
||||||
title: '复制模板',
|
title: t('Duplicate template'),
|
||||||
children: templates.map((template) => {
|
children: templates.map((template) => {
|
||||||
const templateName =
|
const templateName =
|
||||||
template?.componentName === 'FormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name;
|
template?.componentName === 'FormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name;
|
||||||
@ -255,7 +255,7 @@ export const useCollectionDataSourceItems = (componentName) => {
|
|||||||
mode: 'copy',
|
mode: 'copy',
|
||||||
name: item.name,
|
name: item.name,
|
||||||
template,
|
template,
|
||||||
title: templateName || '未命名',
|
title: templateName || t('Untitled'),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@ -263,7 +263,7 @@ export const useCollectionDataSourceItems = (componentName) => {
|
|||||||
key: `${componentName}_table_subMenu_${index}_ref`,
|
key: `${componentName}_table_subMenu_${index}_ref`,
|
||||||
type: 'subMenu',
|
type: 'subMenu',
|
||||||
name: 'ref',
|
name: 'ref',
|
||||||
title: '引用模板',
|
title: t('Reference template'),
|
||||||
children: templates.map((template) => {
|
children: templates.map((template) => {
|
||||||
const templateName =
|
const templateName =
|
||||||
template?.componentName === 'FormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name;
|
template?.componentName === 'FormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name;
|
||||||
@ -272,7 +272,7 @@ export const useCollectionDataSourceItems = (componentName) => {
|
|||||||
mode: 'reference',
|
mode: 'reference',
|
||||||
name: item.name,
|
name: item.name,
|
||||||
template,
|
template,
|
||||||
title: templateName || '未命名',
|
title: templateName || t('Untitled'),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@ -657,7 +657,7 @@ export const createCalendarBlockSchema = (options) => {
|
|||||||
properties: {
|
properties: {
|
||||||
tab1: {
|
tab1: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: '详情',
|
title: '{{t("Details")}}',
|
||||||
'x-component': 'Tabs.TabPane',
|
'x-component': 'Tabs.TabPane',
|
||||||
'x-designer': 'Tabs.Designer',
|
'x-designer': 'Tabs.Designer',
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
@ -725,7 +725,7 @@ export const createKanbanBlockSchema = (options) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
cardAdder: {
|
cardAdder: {
|
||||||
title: '添加卡片',
|
title: '{{t("Add new")}}',
|
||||||
type: 'void',
|
type: 'void',
|
||||||
'x-designer': 'Action.Designer',
|
'x-designer': 'Action.Designer',
|
||||||
'x-designer-props': {
|
'x-designer-props': {
|
||||||
@ -780,7 +780,7 @@ export const createKanbanBlockSchema = (options) => {
|
|||||||
properties: {
|
properties: {
|
||||||
tab1: {
|
tab1: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: '详情',
|
title: '{{t("Details")}}',
|
||||||
'x-component': 'Tabs.TabPane',
|
'x-component': 'Tabs.TabPane',
|
||||||
'x-designer': 'Tabs.Designer',
|
'x-designer': 'Tabs.Designer',
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
|
@ -52,7 +52,7 @@ export const GeneralSchemaDesigner = (props: any) => {
|
|||||||
<div className={classNames('general-schema-designer-title', titleCss)}>
|
<div className={classNames('general-schema-designer-title', titleCss)}>
|
||||||
<Space size={2}>
|
<Space size={2}>
|
||||||
<span className={'title-tag'}>{compile(title)}</span>
|
<span className={'title-tag'}>{compile(title)}</span>
|
||||||
{template && <span className={'title-tag'}>引用模板: {templateName || '未命名'}</span>}
|
{template && <span className={'title-tag'}>{t('Reference template')}: {templateName || t('Untitled')}</span>}
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
import { css } from '@emotion/css';
|
||||||
import { FormDialog, FormItem, FormLayout, Input } from '@formily/antd';
|
import { FormDialog, FormItem, FormLayout, Input } from '@formily/antd';
|
||||||
import { GeneralField } from '@formily/core';
|
import { GeneralField } from '@formily/core';
|
||||||
import { ISchema, Schema, SchemaOptionsContext } from '@formily/react';
|
import { ISchema, Schema, SchemaOptionsContext } from '@formily/react';
|
||||||
import { uid } from '@formily/shared';
|
import { uid } from '@formily/shared';
|
||||||
import { Dropdown, Menu, MenuItemProps, Modal, Select, Switch } from 'antd';
|
import { Dropdown, Menu, MenuItemProps, Modal, Select, Switch } from 'antd';
|
||||||
|
import classNames from 'classnames';
|
||||||
import React, { createContext, useContext, useState } from 'react';
|
import React, { createContext, useContext, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import {
|
import {
|
||||||
@ -87,6 +89,15 @@ export const SchemaSettings: React.FC<SchemaSettingsProps> & SchemaSettingsNeste
|
|||||||
setVisible(visible);
|
setVisible(visible);
|
||||||
}}
|
}}
|
||||||
overlay={<Menu>{props.children}</Menu>}
|
overlay={<Menu>{props.children}</Menu>}
|
||||||
|
overlayClassName={classNames(
|
||||||
|
'nb-schema-initializer-button-overlay',
|
||||||
|
css`
|
||||||
|
.ant-dropdown-menu-item-group-list {
|
||||||
|
max-height: 40vh;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{typeof title === 'string' ? <span>{title}</span> : title}
|
{typeof title === 'string' ? <span>{title}</span> : title}
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
@ -134,7 +145,7 @@ SchemaSettings.Template = (props) => {
|
|||||||
<SchemaSettings.Item
|
<SchemaSettings.Item
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
const values = await FormDialog('Save as template', () => {
|
const values = await FormDialog(t('Save as template'), () => {
|
||||||
return (
|
return (
|
||||||
<FormLayout layout={'vertical'}>
|
<FormLayout layout={'vertical'}>
|
||||||
<SchemaComponent
|
<SchemaComponent
|
||||||
@ -143,7 +154,7 @@ SchemaSettings.Template = (props) => {
|
|||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
name: {
|
name: {
|
||||||
title: '模板名称',
|
title: t('Template name'),
|
||||||
required: true,
|
required: true,
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component': 'Input',
|
'x-component': 'Input',
|
||||||
@ -155,6 +166,7 @@ SchemaSettings.Template = (props) => {
|
|||||||
);
|
);
|
||||||
}).open({});
|
}).open({});
|
||||||
const sdn = createDesignable({
|
const sdn = createDesignable({
|
||||||
|
t,
|
||||||
api,
|
api,
|
||||||
refresh: dn.refresh.bind(dn),
|
refresh: dn.refresh.bind(dn),
|
||||||
current: fieldSchema.parent,
|
current: fieldSchema.parent,
|
||||||
@ -231,6 +243,7 @@ SchemaSettings.FormItemTemplate = (props) => {
|
|||||||
const schema = await copyTemplateSchema(template);
|
const schema = await copyTemplateSchema(template);
|
||||||
const templateSchema = findBlockTemplateSchema(fieldSchema);
|
const templateSchema = findBlockTemplateSchema(fieldSchema);
|
||||||
const sdn = createDesignable({
|
const sdn = createDesignable({
|
||||||
|
t,
|
||||||
api,
|
api,
|
||||||
refresh: dn.refresh.bind(dn),
|
refresh: dn.refresh.bind(dn),
|
||||||
current: templateSchema.parent,
|
current: templateSchema.parent,
|
||||||
@ -275,7 +288,7 @@ SchemaSettings.FormItemTemplate = (props) => {
|
|||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
name: {
|
name: {
|
||||||
title: '模板名称',
|
title: t('Template name'),
|
||||||
required: true,
|
required: true,
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component': 'Input',
|
'x-component': 'Input',
|
||||||
@ -287,6 +300,7 @@ SchemaSettings.FormItemTemplate = (props) => {
|
|||||||
);
|
);
|
||||||
}).open({});
|
}).open({});
|
||||||
const sdn = createDesignable({
|
const sdn = createDesignable({
|
||||||
|
t,
|
||||||
api,
|
api,
|
||||||
refresh: dn.refresh.bind(dn),
|
refresh: dn.refresh.bind(dn),
|
||||||
current: gridSchema.parent,
|
current: gridSchema.parent,
|
||||||
|
@ -256,27 +256,23 @@ export class PluginACL extends Plugin {
|
|||||||
records: [
|
records: [
|
||||||
{
|
{
|
||||||
name: 'root',
|
name: 'root',
|
||||||
title: 'Root',
|
title: '{{t("Root")}}',
|
||||||
hidden: true,
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'admin',
|
name: 'admin',
|
||||||
title: 'Admin',
|
title: '{{t("Admin")}}',
|
||||||
allowConfigure: true,
|
allowConfigure: true,
|
||||||
allowNewMenu: true,
|
allowNewMenu: true,
|
||||||
strategy: { actions: ['create', 'export', 'view', 'update', 'destroy'] },
|
strategy: { actions: ['create', 'export', 'view', 'update', 'destroy'] },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'member',
|
name: 'member',
|
||||||
title: 'Member',
|
title: '{{t("Member")}}',
|
||||||
allowNewMenu: true,
|
allowNewMenu: true,
|
||||||
strategy: { actions: ['view', 'update:own', 'destroy:own', 'create'] },
|
strategy: { actions: ['view', 'update:own', 'destroy:own', 'create'] },
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'anonymous',
|
|
||||||
title: 'Anonymous',
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
const rolesResourcesScopes = this.app.db.getRepository('rolesResourcesScopes');
|
const rolesResourcesScopes = this.app.db.getRepository('rolesResourcesScopes');
|
||||||
|
Loading…
Reference in New Issue
Block a user