fix: extra button control
This commit is contained in:
+2
-2
@@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"concurrent": 2,
|
|
||||||
"*.{md,json}": ["prettier --cache --write"],
|
"*.{md,json}": ["prettier --cache --write"],
|
||||||
"*.{js,jsx}": ["max lint --fix --eslint-only", "prettier --cache --write"],
|
"*.{js,jsx}": ["max lint --fix --eslint-only", "prettier --cache --write"],
|
||||||
"*.{css,less}": [
|
"*.{css,less}": [
|
||||||
@@ -9,5 +8,6 @@
|
|||||||
"*.ts?(x)": [
|
"*.ts?(x)": [
|
||||||
"max lint --fix --eslint-only",
|
"max lint --fix --eslint-only",
|
||||||
"prettier --cache --parser=typescript --write"
|
"prettier --cache --parser=typescript --write"
|
||||||
]
|
],
|
||||||
|
"src/locales/**/*.ts": ["npx tsx src/locales/check.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const RowPrefix: React.FC<RowPrefixProps> = (props) => {
|
|||||||
<IconFont
|
<IconFont
|
||||||
type="icon-down"
|
type="icon-down"
|
||||||
rotate={isExpanded ? 0 : -90}
|
rotate={isExpanded ? 0 : -90}
|
||||||
className="size-14"
|
style={{ fontSize: '12px' }}
|
||||||
></IconFont>
|
></IconFont>
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
@@ -78,7 +78,7 @@ const RowPrefix: React.FC<RowPrefixProps> = (props) => {
|
|||||||
<IconFont
|
<IconFont
|
||||||
type="icon-down"
|
type="icon-down"
|
||||||
rotate={isExpanded ? 0 : -90}
|
rotate={isExpanded ? 0 : -90}
|
||||||
className="size-14"
|
style={{ fontSize: '12px' }}
|
||||||
></IconFont>
|
></IconFont>
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import IconFont from '@/components/icon-font';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language configuration map
|
* Language configuration map
|
||||||
* Warning: The key of the map must be the same as the directory name in the locales directory
|
* Warning: The key of the map must be the same as the directory name in the locales directory
|
||||||
@@ -70,7 +68,7 @@ const langConfigMap = {
|
|||||||
'en-US': {
|
'en-US': {
|
||||||
lang: 'en-US',
|
lang: 'en-US',
|
||||||
label: 'English',
|
label: 'English',
|
||||||
icon: <IconFont type="icon-English" />,
|
icon: '🇺🇸',
|
||||||
title: 'Language'
|
title: 'Language'
|
||||||
},
|
},
|
||||||
'es-ES': {
|
'es-ES': {
|
||||||
@@ -322,7 +320,7 @@ const langConfigMap = {
|
|||||||
'zh-CN': {
|
'zh-CN': {
|
||||||
lang: 'zh-CN',
|
lang: 'zh-CN',
|
||||||
label: '简体中文',
|
label: '简体中文',
|
||||||
icon: <IconFont type="icon-chinese" />,
|
icon: '🇨🇳',
|
||||||
title: '语言'
|
title: '语言'
|
||||||
},
|
},
|
||||||
'zh-TW': {
|
'zh-TW': {
|
||||||
|
|||||||
@@ -5,7 +5,14 @@ import { CloseOutlined } from '@ant-design/icons';
|
|||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Drawer } from 'antd';
|
import { Button, Drawer } from 'antd';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
|
import React, {
|
||||||
|
memo,
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useRef,
|
||||||
|
useState
|
||||||
|
} from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { queryCatalogItemSpec } from '../apis';
|
import { queryCatalogItemSpec } from '../apis';
|
||||||
import {
|
import {
|
||||||
@@ -448,6 +455,10 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
axiosToken.current?.cancel?.();
|
axiosToken.current?.cancel?.();
|
||||||
}, [onCancel]);
|
}, [onCancel]);
|
||||||
|
|
||||||
|
const showExtraButton = useMemo(() => {
|
||||||
|
return warningStatus.show && warningStatus.type !== 'success';
|
||||||
|
}, [warningStatus.show, warningStatus.type]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (open) {
|
if (open) {
|
||||||
fetchSpecData();
|
fetchSpecData();
|
||||||
@@ -542,12 +553,9 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
<ModalFooter
|
<ModalFooter
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
onOk={handleSumit}
|
onOk={handleSumit}
|
||||||
showOkBtn={
|
showOkBtn={!showExtraButton}
|
||||||
!warningStatus.show || warningStatus.type === 'success'
|
|
||||||
}
|
|
||||||
extra={
|
extra={
|
||||||
warningStatus.show &&
|
showExtraButton && (
|
||||||
warningStatus.type !== 'success' && (
|
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={handleSubmitAnyway}
|
onClick={handleSubmitAnyway}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { CloseOutlined } from '@ant-design/icons';
|
|||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Drawer } from 'antd';
|
import { Button, Drawer } from 'antd';
|
||||||
import _, { debounce } from 'lodash';
|
import _, { debounce } from 'lodash';
|
||||||
import { FC, useCallback, useEffect, useRef, useState } from 'react';
|
import { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import {
|
import {
|
||||||
backendOptionsMap,
|
backendOptionsMap,
|
||||||
@@ -229,6 +229,10 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const showExtraButton = useMemo(() => {
|
||||||
|
return warningStatus.show && warningStatus.type !== 'success';
|
||||||
|
}, [warningStatus.show, warningStatus.type]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (open) {
|
if (open) {
|
||||||
handleOnOpen();
|
handleOnOpen();
|
||||||
@@ -338,12 +342,9 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
<ModalFooter
|
<ModalFooter
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
onOk={handleSumit}
|
onOk={handleSumit}
|
||||||
showOkBtn={
|
showOkBtn={!showExtraButton}
|
||||||
!warningStatus.show || warningStatus.type === 'success'
|
|
||||||
}
|
|
||||||
extra={
|
extra={
|
||||||
warningStatus.show &&
|
showExtraButton && (
|
||||||
warningStatus.type !== 'success' && (
|
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={handleSubmitAnyway}
|
onClick={handleSubmitAnyway}
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
|
|
||||||
const data = form.getFieldsValue?.();
|
const data = form.getFieldsValue?.();
|
||||||
const res = handleBackendChangeBefore(data);
|
const res = handleBackendChangeBefore(data);
|
||||||
|
console.log('res+++++++++++', res);
|
||||||
if (res.show) {
|
if (res.show) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -393,6 +394,14 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
onCancel?.();
|
onCancel?.();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const showExtraButton = useMemo(() => {
|
||||||
|
return (
|
||||||
|
warningStatus.show &&
|
||||||
|
warningStatus.type !== 'success' &&
|
||||||
|
!warningStatus.isDefault
|
||||||
|
);
|
||||||
|
}, [warningStatus.show, warningStatus.type, warningStatus.isDefault]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (open && formData) {
|
if (open && formData) {
|
||||||
setOriginalFormData();
|
setOriginalFormData();
|
||||||
@@ -441,15 +450,9 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
<ModalFooter
|
<ModalFooter
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
onOk={handleSumit}
|
onOk={handleSumit}
|
||||||
showOkBtn={
|
showOkBtn={!showExtraButton}
|
||||||
!warningStatus.show ||
|
|
||||||
warningStatus.type === 'success' ||
|
|
||||||
warningStatus.isDefault
|
|
||||||
}
|
|
||||||
extra={
|
extra={
|
||||||
warningStatus.show &&
|
showExtraButton && (
|
||||||
warningStatus.type !== 'success' &&
|
|
||||||
!warningStatus.isDefault && (
|
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={handleSubmitAnyway}
|
onClick={handleSubmitAnyway}
|
||||||
|
|||||||
Reference in New Issue
Block a user