fix(plugin-workflow): fix schedule config component witdh (#2461)

This commit is contained in:
Junyi 2023-08-15 21:10:46 +07:00 committed by GitHub
parent 9b00aa9cc0
commit 5581b4f872
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -25,9 +25,10 @@ function getNumberOption(v) {
} }
function getRepeatTypeValue(v) { function getRepeatTypeValue(v) {
let option;
switch (typeof v) { switch (typeof v) {
case 'number': case 'number':
const option = getNumberOption(v); option = getNumberOption(v);
return option ? option.value : 'none'; return option ? option.value : 'none';
case 'string': case 'string':
return 'cron'; return 'cron';
@ -48,6 +49,7 @@ function CommonRepeatField({ value, onChange }) {
min={1} min={1}
addonBefore={t('Every')} addonBefore={t('Every')}
addonAfter={t(option.unitText)} addonAfter={t(option.unitText)}
className="auto-width"
/> />
); );
} }
@ -78,6 +80,7 @@ export function RepeatField({ value = null, onChange }) {
gap: 0.5em; gap: 0.5em;
.react-js-cron { .react-js-cron {
width: 100%;
padding: 0.5em 0.5em 0 0.5em; padding: 0.5em 0.5em 0 0.5em;
border: 1px dashed #ccc; border: 1px dashed #ccc;
@ -92,10 +95,16 @@ export function RepeatField({ value = null, onChange }) {
margin: 0 0.5em 0 0; margin: 0 0.5em 0 0;
} }
} }
.react-js-cron-week-days {
> span {
min-width: 2em;
}
}
} }
`} `}
> >
<Select value={typeValue} onChange={onTypeChange}> <Select value={typeValue} onChange={onTypeChange} className="auto-width">
{RepeatOptions.map((item) => ( {RepeatOptions.map((item) => (
<Select.Option key={item.value} value={item.value}> <Select.Option key={item.value} value={item.value}>
{t(item.text)} {t(item.text)}

View File

@ -203,7 +203,8 @@ export const ScheduleConfig = () => {
'x-component-props': { 'x-component-props': {
className: css` className: css`
.ant-input-number { .ant-input-number {
width: 4em; width: auto;
min-width: 6em;
} }
.ant-picker { .ant-picker {