fix: default action schema settings (#3146)
* fix: default action schema settings * fix: customRequest
This commit is contained in:
parent
ad25fe704c
commit
e418d31eb8
@ -1,7 +1,14 @@
|
||||
import i18next from 'i18next';
|
||||
import i18next, { TFuncKey, TOptions } from 'i18next';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
import locale from '../locale';
|
||||
|
||||
export function tval(text: TFuncKey | TFuncKey[], options?: TOptions) {
|
||||
if (options) {
|
||||
return `{{t(${JSON.stringify(text)}, ${JSON.stringify(options)})}}`;
|
||||
}
|
||||
return `{{t(${JSON.stringify(text)})}}`;
|
||||
}
|
||||
|
||||
export const i18n = i18next.createInstance();
|
||||
|
||||
const resources = {};
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ConfigProvider } from 'antd';
|
||||
import { App, ConfigProvider } from 'antd';
|
||||
import dayjs from 'dayjs';
|
||||
import { loadConstrueLocale } from '../../antd-config-provider/loadConstrueLocale';
|
||||
import { Plugin } from '../../application/Plugin';
|
||||
@ -19,6 +19,7 @@ export class LocalePlugin extends Plugin {
|
||||
const data = res?.data;
|
||||
this.locales = data?.data || {};
|
||||
this.app.use(ConfigProvider, { locale: this.locales.antd, popupMatchSelectWidth: false });
|
||||
this.app.use(App);
|
||||
if (data?.data?.lang && !locale) {
|
||||
api.auth.setLocale(data?.data?.lang);
|
||||
this.app.i18n.changeLanguage(data?.data?.lang);
|
||||
|
@ -7,9 +7,10 @@ import { cloneDeep } from 'lodash';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { RemoteSelect, useCompile, useDesignable } from '../..';
|
||||
import { useApp } from '../../../application';
|
||||
import { usePlugin } from '../../../application/hooks';
|
||||
import { SchemaSettingOptions, SchemaSettings } from '../../../application/schema-settings';
|
||||
import { useSchemaToolbar } from '../../../application/schema-toolbar';
|
||||
import { SchemaSettings, SchemaSettingOptions } from '../../../application/schema-settings';
|
||||
import { CollectionOptions, useCollection, useCollectionManager } from '../../../collection-manager';
|
||||
import { FlagProvider } from '../../../flag-provider';
|
||||
import { useRecord } from '../../../record-provider';
|
||||
@ -30,7 +31,6 @@ import {
|
||||
import { DefaultValueProvider } from '../../../schema-settings/hooks/useIsAllowToSetDefaultValue';
|
||||
import { useLinkageAction } from './hooks';
|
||||
import { requestSettingsSchema } from './utils';
|
||||
import { useApp } from '../../../application';
|
||||
|
||||
const Tree = connect(
|
||||
AntdTree,
|
||||
@ -1089,7 +1089,7 @@ export const ActionDesigner = (props) => {
|
||||
const fieldSchema = useFieldSchema();
|
||||
const isDraggable = fieldSchema?.parent['x-component'] !== 'CollectionField';
|
||||
const settingsName = `ActionSettings:${fieldSchema['x-action']}`;
|
||||
const defaultActionSettings = 'ActionSettings';
|
||||
const defaultActionSettings = schemaSettings || 'ActionSettings';
|
||||
const hasAction = app.schemaSettingsManager.has(settingsName);
|
||||
|
||||
return (
|
||||
|
@ -222,7 +222,7 @@ export const gridCardItemActionInitializers = new SchemaInitializer({
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'custom-request',
|
||||
name: 'customRequest',
|
||||
title: '{{t("Custom request")}}',
|
||||
Component: 'CustomRequestInitializer',
|
||||
schema: {
|
||||
|
@ -275,26 +275,11 @@ export const tableActionColumnInitializers = new SchemaInitializer({
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
title: '{{t("Custom request")}}',
|
||||
name: 'customRequest',
|
||||
Component: 'CustomizeActionInitializer',
|
||||
title: '{{t("Custom request")}}',
|
||||
Component: 'CustomRequestInitializer',
|
||||
schema: {
|
||||
title: '{{ t("Custom request") }}',
|
||||
'x-component': 'Action.Link',
|
||||
'x-action': 'customize:table:request',
|
||||
'x-designer': 'Action.Designer',
|
||||
'x-action-settings': {
|
||||
requestSettings: {},
|
||||
onSuccess: {
|
||||
manualClose: false,
|
||||
redirecting: false,
|
||||
successMessage: '{{t("Request success")}}',
|
||||
},
|
||||
},
|
||||
'x-component-props': {
|
||||
useProps: '{{ useCustomizeRequestActionProps }}',
|
||||
},
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection();
|
||||
|
Loading…
Reference in New Issue
Block a user