fix(plugin-workflow): fix styles (#2316)

This commit is contained in:
Junyi 2023-07-25 15:41:42 +07:00 committed by GitHub
parent 30b0d9b3f3
commit e27c72e8b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 83 additions and 65 deletions

View File

@ -5,50 +5,42 @@ const useStyles = genStyleHook('nb-action', (token) => {
return { return {
[componentCls]: { [componentCls]: {
'.renderButton': { position: 'relative',
position: 'relative', '&:hover': { '> .general-schema-designer': { display: 'block' } },
'&:hover': { '> .general-schema-designer': { display: 'block' } }, '&.nb-action-link': {
'&.nb-action-link': {
'> .general-schema-designer': {
top: '-10px',
bottom: '-10px',
left: '-10px',
right: '-10px',
},
},
'> .general-schema-designer': { '> .general-schema-designer': {
position: 'absolute', top: '-10px',
zIndex: 999, bottom: '-10px',
top: '0', left: '-10px',
bottom: '0', right: '-10px',
left: '0',
right: '0',
display: 'none',
background: 'var(--colorBgSettingsHover)',
border: '0',
pointerEvents: 'none',
'> .general-schema-designer-icons': {
position: 'absolute',
right: '2px',
top: '2px',
lineHeight: '16px',
pointerEvents: 'all',
'.ant-space-item': {
backgroundColor: token.colorSettings,
color: '#fff',
lineHeight: '16px',
width: '16px',
paddingLeft: '1px',
alignSelf: 'stretch',
},
},
}, },
}, },
'> .general-schema-designer': {
'.popover': { position: 'absolute',
display: 'flex', zIndex: 999,
justifyContent: 'flex-end', top: '0',
width: '100%', bottom: '0',
left: '0',
right: '0',
display: 'none',
background: 'var(--colorBgSettingsHover)',
border: '0',
pointerEvents: 'none',
'> .general-schema-designer-icons': {
position: 'absolute',
right: '2px',
top: '2px',
lineHeight: '16px',
pointerEvents: 'all',
'.ant-space-item': {
backgroundColor: token.colorSettings,
color: '#fff',
lineHeight: '16px',
width: '16px',
paddingLeft: '1px',
alignSelf: 'stretch',
},
},
}, },
}, },
}; };

View File

@ -1,4 +1,5 @@
import { observer, RecursionField, useField, useFieldSchema, useForm } from '@formily/react'; import { observer, RecursionField, useField, useFieldSchema, useForm } from '@formily/react';
import { lodash } from '@nocobase/utils';
import { App, Button, Popover } from 'antd'; import { App, Button, Popover } from 'antd';
import classnames from 'classnames'; import classnames from 'classnames';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
@ -21,7 +22,6 @@ import { ActionContextProvider } from './context';
import { useA } from './hooks'; import { useA } from './hooks';
import { ComposedAction } from './types'; import { ComposedAction } from './types';
import { linkageAction } from './utils'; import { linkageAction } from './utils';
import { lodash } from '@nocobase/utils';
export const Action: ComposedAction = observer( export const Action: ComposedAction = observer(
(props: any) => { (props: any) => {
@ -105,7 +105,7 @@ export const Action: ComposedAction = observer(
} }
}} }}
component={tarComponent || Button} component={tarComponent || Button}
className={classnames('renderButton', className)} className={classnames(componentCls, hashId, className)}
type={props.type === 'danger' ? undefined : props.type} type={props.type === 'danger' ? undefined : props.type}
> >
{actionTitle} {actionTitle}
@ -115,24 +115,22 @@ export const Action: ComposedAction = observer(
}; };
return wrapSSR( return wrapSSR(
<div className={`${componentCls} ${hashId}`}> <ActionContextProvider
<ActionContextProvider button={renderButton()}
button={renderButton()} visible={visible}
visible={visible} setVisible={setVisible}
setVisible={setVisible} formValueChanged={formValueChanged}
formValueChanged={formValueChanged} setFormValueChanged={setFormValueChanged}
setFormValueChanged={setFormValueChanged} openMode={openMode}
openMode={openMode} openSize={openSize}
openSize={openSize} containerRefKey={containerRefKey}
containerRefKey={containerRefKey} fieldSchema={fieldSchema}
fieldSchema={fieldSchema} >
> {popover && <RecursionField basePath={field.address} onlyRenderProperties schema={fieldSchema} />}
{popover && <RecursionField basePath={field.address} onlyRenderProperties schema={fieldSchema} />} {!popover && renderButton()}
{!popover && renderButton()} {!popover && <div onClick={(e) => e.stopPropagation()}>{props.children}</div>}
{!popover && <div onClick={(e) => e.stopPropagation()}>{props.children}</div>} {element}
{element} </ActionContextProvider>,
</ActionContextProvider>
</div>,
); );
}, },
{ displayName: 'Action' }, { displayName: 'Action' },
@ -160,7 +158,17 @@ Action.Popover = observer(
Action.Popover.Footer = observer( Action.Popover.Footer = observer(
(props) => { (props) => {
return <div className="popover">{props.children}</div>; return (
<div
style={{
display: 'flex',
justifyContent: 'flex-end',
width: '100%',
}}
>
{props.children}
</div>
);
}, },
{ displayName: 'Action.Popover.Footer' }, { displayName: 'Action.Popover.Footer' },
); );

View File

@ -441,10 +441,25 @@ export function NodeDefaultView(props) {
'x-component': 'fieldset', 'x-component': 'fieldset',
'x-component-props': { 'x-component-props': {
className: css` className: css`
.ant-input,
.ant-select, .ant-select,
.ant-cascader-picker, .ant-cascader-picker,
.ant-picker, .ant-picker,
.ant-input-number, .ant-input-number,
.ant-input-affix-wrapper {
&:not(.full-width) {
width: auto;
min-width: 6em;
}
}
.ant-input-affix-wrapper {
&:not(.full-width) {
.ant-input {
width: auto;
min-width: 6em;
}
}
}
`, `,
}, },
properties: instruction.fieldset, properties: instruction.fieldset,

View File

@ -96,7 +96,7 @@ const useStyles = createStyles(({ css, token }) => {
bottom: 0; bottom: 0;
left: calc(50% - 0.5px); left: calc(50% - 0.5px);
width: 1px; width: 1px;
background-color: ${token.colorBorder}; background-color: ${token.colorBgLayout};
} }
`, `,
@ -220,7 +220,9 @@ const useStyles = createStyles(({ css, token }) => {
font-weight: bold; font-weight: bold;
&:not(:focus) { &:not(:focus) {
transition: background-color 0.3s ease, border-color 0.3s ease; transition:
background-color 0.3s ease,
border-color 0.3s ease;
border-color: ${token.colorBorderBg}; border-color: ${token.colorBorderBg};
background-color: ${token.colorBgContainerDisabled}; background-color: ${token.colorBgContainerDisabled};
@ -254,7 +256,7 @@ const useStyles = createStyles(({ css, token }) => {
right: 1em; right: 1em;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
color: ${token.colorText}; color: ${token.colorTextLightSolid};
&[type='button'] { &[type='button'] {
border: none; border: none;
@ -327,6 +329,7 @@ const useStyles = createStyles(({ css, token }) => {
top: calc(1.5em - 1px); top: calc(1.5em - 1px);
line-height: 1em; line-height: 1em;
color: ${token.colorTextSecondary}; color: ${token.colorTextSecondary};
background-color: ${token.colorBgLayout};
padding: 1px; padding: 1px;
} }
`, `,