mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2024-11-21 03:15:49 +08:00
change some components' property to optional
This commit is contained in:
parent
30d1932d2e
commit
451590b581
@ -3,16 +3,8 @@ import { Static, Type } from '@sinclair/typebox';
|
||||
import { Stack as BaseStack } from '@chakra-ui/react';
|
||||
import { ComponentImplementation, Slot } from '@sunmao-ui/runtime';
|
||||
|
||||
export const DirectionSchema = Type.Union([
|
||||
Type.KeyOf(
|
||||
Type.Object({
|
||||
column: Type.String(),
|
||||
'column-reverse': Type.String(),
|
||||
row: Type.String(),
|
||||
'row-reverse': Type.String(),
|
||||
})
|
||||
),
|
||||
Type.Array(
|
||||
export const DirectionSchema = Type.Optional(
|
||||
Type.Union([
|
||||
Type.KeyOf(
|
||||
Type.Object({
|
||||
column: Type.String(),
|
||||
@ -20,16 +12,26 @@ export const DirectionSchema = Type.Union([
|
||||
row: Type.String(),
|
||||
'row-reverse': Type.String(),
|
||||
})
|
||||
)
|
||||
),
|
||||
]);
|
||||
export const FlexWrapSchema = Type.KeyOf(
|
||||
),
|
||||
Type.Array(
|
||||
Type.KeyOf(
|
||||
Type.Object({
|
||||
column: Type.String(),
|
||||
'column-reverse': Type.String(),
|
||||
row: Type.String(),
|
||||
'row-reverse': Type.String(),
|
||||
})
|
||||
)
|
||||
),
|
||||
])
|
||||
);
|
||||
export const FlexWrapSchema = Type.Optional(Type.KeyOf(
|
||||
Type.Object({
|
||||
nowrap: Type.String(),
|
||||
wrap: Type.String(),
|
||||
'wrap-reverse': Type.String(),
|
||||
})
|
||||
);
|
||||
));
|
||||
export const AlignItemsSchema = Type.String();
|
||||
export const JustifyContentSchema = Type.String();
|
||||
export const SpacingSchema = Type.Union([Type.String(), Type.Number()]);
|
||||
|
@ -130,7 +130,7 @@ export const TableImpl: ComponentImplementation<{
|
||||
|
||||
const tableContent = (
|
||||
<>
|
||||
<BaseTable size={size}>
|
||||
<BaseTable size={size || 'md'}>
|
||||
<Thead>
|
||||
<Tr height="10">
|
||||
{isMultiSelect ? allCheckbox : undefined}
|
||||
|
@ -4,13 +4,13 @@ import { RuntimeModuleSchema, EventHandlerSchema } from '@sunmao-ui/runtime';
|
||||
export const MajorKeyPropertySchema = Type.String();
|
||||
export const RowsPerPagePropertySchema = Type.Number();
|
||||
export const DataPropertySchema = Type.Array(Type.Any());
|
||||
export const TableSizePropertySchema = Type.KeyOf(
|
||||
export const TableSizePropertySchema = Type.Optional(Type.KeyOf(
|
||||
Type.Object({
|
||||
sm: Type.String(),
|
||||
md: Type.String(),
|
||||
lg: Type.String(),
|
||||
})
|
||||
);
|
||||
));
|
||||
|
||||
export const TdTypeSchema = Type.KeyOf(
|
||||
Type.Object({
|
||||
|
@ -187,7 +187,7 @@ export const UserCenterApp: Application = {
|
||||
traits: [
|
||||
{
|
||||
type: 'core/v1/slot',
|
||||
properties: { container: { id: 'hhhh', slot: 'content' } },
|
||||
properties: { container: { id: 'tabs1', slot: 'content' } },
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -206,7 +206,7 @@ export const UserCenterApp: Application = {
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'isUpdateRole',
|
||||
id: 'isUpdatePosition',
|
||||
type: 'core/v1/dummy',
|
||||
properties: {},
|
||||
traits: [
|
||||
|
@ -80,6 +80,7 @@ export class ComponentPropertyValidatorRule implements ComponentValidatorRule {
|
||||
const validate = ajv.compile(propertySchema);
|
||||
const valid = validate(component.properties);
|
||||
if (!valid) {
|
||||
console.log('validate.errors', validate.errors)
|
||||
validate.errors!.forEach(error => {
|
||||
let errorMsg = error.message;
|
||||
if (error.keyword === 'type') {
|
||||
@ -124,6 +125,7 @@ export class TraitPropertyValidatorRule implements TraitValidatorRule {
|
||||
const validate = ajv.compile(propertySchema);
|
||||
const valid = validate(trait.properties);
|
||||
if (!valid) {
|
||||
console.log('validate.errors', validate.errors)
|
||||
validate.errors!.forEach(error => {
|
||||
let errorMsg = error.message;
|
||||
if (error.keyword === 'type') {
|
||||
|
Loading…
Reference in New Issue
Block a user