fix some style bugs

This commit is contained in:
Bowen Tan 2022-01-27 13:52:33 +08:00
parent 84f311982d
commit cc21a427e0
5 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { sortBy } from 'lodash-es';
import { isArray, sortBy } from 'lodash-es';
import {
Table as BaseTable,
Thead,
@ -63,6 +63,7 @@ export const TableImpl = implementTable(
}, [data, updateSelectedItem, updateSelectedItems]);
const sortedData = useMemo(() => {
if (!isArray(data)) return [];
if (!sortRule) return data;
const sorted = sortBy(data, sortRule.key);
return sortRule.desc ? sorted.reverse() : sorted;

View File

@ -153,7 +153,7 @@ export const ComponentForm: React.FC<Props> = observer(props => {
</VStack>
</VStack>
<EventTraitForm component={selectedComponent} services={services} />
{ hasFetchTrait ? <FetchTraitForm component={selectedComponent} services={services} /> : null }
{ hasFetchTrait ? <FetchTraitForm key={selectedComponent.id} component={selectedComponent} services={services} /> : null }
<StyleTraitForm component={selectedComponent} services={services} />
<GeneralTraitFormList component={selectedComponent} services={services} />
</VStack>

View File

@ -41,7 +41,7 @@ export const FetchTraitForm: React.FC<Props> = props => {
?.properties as Static<typeof FetchTraitPropertiesSchema>;
const formik = useFormik({
initialValues: fetchTrait,
initialValues: { onComplete: [], onError: [], ...fetchTrait },
onSubmit: values => {
const index = component.traits.findIndex(t => t.type === 'core/v1/fetch');
eventBus.send(

View File

@ -33,7 +33,7 @@ const ArrayField: React.FC<Props> = props => {
<>
{formData.map((v, idx) => {
return (
<Box key={idx} mb={2}>
<Box key={idx} mb={2} border='1px solid black' borderColor='gray.200' borderRadius='4' padding='8px'>
<ButtonGroup
spacing={0}
size="xs"

View File

@ -75,6 +75,7 @@ export const WarningArea: React.FC<Props> = observer(({ services }) => {
paddingY="2"
paddingX="4"
boxShadow="0 0 4px rgba(0, 0, 0, 0.1)"
background='white'
>
<HStack width="full" justifyContent="space-between">
<Text fontSize="md" fontWeight="bold">