mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
feat: mobile modal bug (#4976)
* fix(T-4958): after closing the model, to reset the Form data * fix: bug
This commit is contained in:
parent
3a9b546f4f
commit
a2da825b31
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { observer, RecursionField, useField, useFieldSchema } from '@formily/react';
|
import { observer, RecursionField, useField, useFieldSchema, useForm } from '@formily/react';
|
||||||
import { Modal, ModalProps } from 'antd';
|
import { Modal, ModalProps } from 'antd';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
@ -41,6 +41,7 @@ export const InternalActionModal: React.FC<ActionDrawerProps<ModalProps>> = obse
|
|||||||
const { visible, setVisible, openSize = 'middle', modalProps } = useActionContext();
|
const { visible, setVisible, openSize = 'middle', modalProps } = useActionContext();
|
||||||
const actualWidth = width ?? openSizeWidthMap.get(openSize);
|
const actualWidth = width ?? openSizeWidthMap.get(openSize);
|
||||||
const schema = useFieldSchema();
|
const schema = useFieldSchema();
|
||||||
|
const form = useForm();
|
||||||
const field = useField();
|
const field = useField();
|
||||||
const { token } = useToken();
|
const { token } = useToken();
|
||||||
const footerSchema = schema.reduceProperties((buf, s) => {
|
const footerSchema = schema.reduceProperties((buf, s) => {
|
||||||
@ -79,7 +80,10 @@ export const InternalActionModal: React.FC<ActionDrawerProps<ModalProps>> = obse
|
|||||||
}}
|
}}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
open={visible}
|
open={visible}
|
||||||
onCancel={() => setVisible(false, true)}
|
onCancel={() => {
|
||||||
|
setVisible(false, true);
|
||||||
|
form.reset();
|
||||||
|
}}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
others.className,
|
others.className,
|
||||||
modalProps?.className,
|
modalProps?.className,
|
||||||
|
@ -70,19 +70,19 @@ test('menu permission ', async ({ page, mockPage, mockRole, updateRole }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('i18n should not fallbackNS', async ({ page }) => {
|
test('i18n should not fallbackNS', async ({ page }) => {
|
||||||
await page.goto('/admin');
|
await page.goto('/admin/settings/system-settings');
|
||||||
|
|
||||||
// 创建 Users 页面
|
// 创建 Users 页面
|
||||||
await page.getByTestId('schema-initializer-Menu-header').hover();
|
await page.getByTestId('schema-initializer-Menu-header').hover();
|
||||||
await page.getByRole('menuitem', { name: 'Page' }).click();
|
await page.getByRole('menuitem', { name: 'Page' }).click();
|
||||||
await page.getByRole('textbox').click();
|
await page.getByLabel('block-item-Input-Menu item').getByRole('textbox').click();
|
||||||
await page.getByRole('textbox').fill('Users');
|
await page.getByLabel('block-item-Input-Menu item').getByRole('textbox').fill('Users');
|
||||||
await page.getByRole('button', { name: 'OK' }).click();
|
await page.getByRole('button', { name: 'OK' }).click();
|
||||||
await expect(page.getByLabel('Users')).toBeVisible();
|
await expect(page.getByLabel('Users')).toBeVisible();
|
||||||
await expect(page.getByLabel('用户')).not.toBeVisible();
|
await expect(page.getByLabel('用户')).not.toBeVisible();
|
||||||
|
|
||||||
// 添加中文选项
|
// 添加中文选项
|
||||||
await page.goto('/admin/settings/system-settings');
|
await page.reload();
|
||||||
await page.getByTestId('select-multiple').click();
|
await page.getByTestId('select-multiple').click();
|
||||||
await page.getByRole('option', { name: '简体中文 (zh-CN)' }).click();
|
await page.getByRole('option', { name: '简体中文 (zh-CN)' }).click();
|
||||||
await page.getByLabel('action-Action-Submit').click();
|
await page.getByLabel('action-Action-Submit').click();
|
||||||
@ -92,7 +92,7 @@ test('i18n should not fallbackNS', async ({ page }) => {
|
|||||||
await page.getByText('LanguageEnglish').click();
|
await page.getByText('LanguageEnglish').click();
|
||||||
await page.getByRole('option', { name: '简体中文' }).click();
|
await page.getByRole('option', { name: '简体中文' }).click();
|
||||||
|
|
||||||
await page.goto('/admin/settings/system-settings');
|
// await page.reload();
|
||||||
|
|
||||||
// 应该显示 Users 而非中文 “用户”
|
// 应该显示 Users 而非中文 “用户”
|
||||||
await expect(page.getByLabel('Users')).toBeVisible();
|
await expect(page.getByLabel('Users')).toBeVisible();
|
||||||
|
@ -29,7 +29,7 @@ export class PluginMobileClient extends Plugin {
|
|||||||
|
|
||||||
addSettings() {
|
addSettings() {
|
||||||
this.app.pluginSettingsManager.add(NAMESPACE, {
|
this.app.pluginSettingsManager.add(NAMESPACE, {
|
||||||
title: `{{t("Mobile Client-side", { ns: "${NAMESPACE}" })}}`,
|
title: `{{t("Mobile Client-side(Deprecated)", { ns: "${NAMESPACE}" })}}`,
|
||||||
icon: 'MobileOutlined',
|
icon: 'MobileOutlined',
|
||||||
Component: () => <Outlet />,
|
Component: () => <Outlet />,
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"Mobile Client-side": "Mobile Client-side",
|
"Mobile Client-side(Deprecated)": "Mobile Client-side(Deprecated)",
|
||||||
"Interface Configuration": "Interface Configuration",
|
"Interface Configuration": "Interface Configuration",
|
||||||
"App Configuration": "App Configuration",
|
"App Configuration": "App Configuration",
|
||||||
"Enable TabBar": "Enable TabBar",
|
"Enable TabBar": "Enable TabBar",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"Mobile Client-side": "移动端",
|
"Mobile Client-side(Deprecated)": "移动端(已废弃)",
|
||||||
"Interface Configuration": "界面配置",
|
"Interface Configuration": "界面配置",
|
||||||
"App Configuration": "App配置",
|
"App Configuration": "App配置",
|
||||||
"Enable TabBar": "启用底部标签栏",
|
"Enable TabBar": "启用底部标签栏",
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
"homepage": "https://docs.nocobase.com/handbook/mobile",
|
"homepage": "https://docs.nocobase.com/handbook/mobile",
|
||||||
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/mobile",
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/mobile",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"displayName": "Mobile(Developing)",
|
"displayName": "Mobile",
|
||||||
"displayName.zh-CN": "移动端(开发中)",
|
"displayName.zh-CN": "移动端",
|
||||||
"description": "Provides the ability to configure mobile pages.",
|
"description": "Provides the ability to configure mobile pages.",
|
||||||
"description.zh-CN": "提供移动端页面配置的能力。",
|
"description.zh-CN": "提供移动端页面配置的能力。",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user