mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2024-11-27 08:39:59 +08:00
188 lines
4.4 KiB
TypeScript
188 lines
4.4 KiB
TypeScript
import { Application, ComponentSchema } from '@sunmao-ui/core';
|
|
|
|
export const AppSchema: Application = {
|
|
kind: 'Application',
|
|
version: 'example/v1',
|
|
metadata: { name: 'dialog_component', description: 'dialog component example' },
|
|
spec: {
|
|
components: [
|
|
{
|
|
id: 'hstack1',
|
|
type: 'chakra_ui/v1/hstack',
|
|
properties: { spacing: '24px' },
|
|
traits: [],
|
|
},
|
|
{
|
|
id: 'vstack1',
|
|
type: 'chakra_ui/v1/vstack',
|
|
properties: {},
|
|
traits: [
|
|
{
|
|
type: 'core/v1/slot',
|
|
properties: { container: { id: 'hstack1', slot: 'content' } },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'text3',
|
|
type: 'core/v1/text',
|
|
properties: { value: { raw: 'VM1', format: 'plain' } },
|
|
traits: [
|
|
{
|
|
type: 'core/v1/slot',
|
|
properties: { container: { id: 'vstack1', slot: 'content' } },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'text4',
|
|
type: 'core/v1/text',
|
|
properties: { value: { raw: '虚拟机', format: 'plain' } },
|
|
traits: [
|
|
{
|
|
type: 'core/v1/slot',
|
|
properties: { container: { id: 'vstack1', slot: 'content' } },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'hstack2',
|
|
type: 'chakra_ui/v1/hstack',
|
|
properties: { spacing: '24px', align: '' },
|
|
traits: [
|
|
{
|
|
type: 'core/v1/slot',
|
|
properties: { container: { id: 'hstack1', slot: 'content' } },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'text1',
|
|
type: 'core/v1/text',
|
|
properties: { value: { raw: 'text', format: 'plain' } },
|
|
traits: [
|
|
{
|
|
type: 'core/v1/slot',
|
|
properties: { container: { id: 'hstack2', slot: 'content' } },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'text2',
|
|
type: 'core/v1/text',
|
|
properties: { value: { raw: 'text', format: 'plain' } },
|
|
traits: [
|
|
{
|
|
type: 'core/v1/slot',
|
|
properties: { container: { id: 'hstack2', slot: 'content' } },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'button1',
|
|
type: 'plain/v1/button',
|
|
properties: {
|
|
text: { raw: 'text', format: 'plain' },
|
|
},
|
|
traits: [
|
|
{
|
|
type: 'core/v1/slot',
|
|
properties: { container: { id: 'hstack2', slot: 'content' } },
|
|
},
|
|
{
|
|
type: 'core/v1/state',
|
|
properties: { key: 'value' },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'moduleContainer1',
|
|
type: 'core/v1/moduleContainer',
|
|
properties: { id: 'myModule', type: 'custom/v1/module' },
|
|
traits: [
|
|
{
|
|
type: 'core/v1/slot',
|
|
properties: { container: { id: 'hstack1', slot: 'content' } },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'apiFetch',
|
|
type: 'core/v1/dummy',
|
|
properties: {},
|
|
traits: [
|
|
{
|
|
type: 'core/v1/fetch',
|
|
properties: {
|
|
url: 'https://6177d4919c328300175f5b99.mockapi.io/users',
|
|
method: 'get',
|
|
lazy: false,
|
|
headers: {},
|
|
body: {},
|
|
onComplete: [],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
};
|
|
|
|
export const DuplicatedIdSchema: ComponentSchema[] = [
|
|
{
|
|
id: 'hstack1',
|
|
type: 'chakra_ui/v1/hstack',
|
|
properties: { spacing: '24px' },
|
|
traits: [],
|
|
},
|
|
{
|
|
id: 'hstack1',
|
|
type: 'chakra_ui/v1/hstack',
|
|
properties: { spacing: '24px' },
|
|
traits: [],
|
|
},
|
|
{
|
|
id: 'hstack3',
|
|
type: 'chakra_ui/v1/hstack',
|
|
properties: { spacing: '24px' },
|
|
traits: [],
|
|
},
|
|
];
|
|
|
|
export const EventHanlderMockSchema: ComponentSchema[] = [
|
|
{
|
|
id: 'button1',
|
|
type: 'chakra_ui/v1/button',
|
|
properties: {},
|
|
traits: [
|
|
{
|
|
type: 'core/v1/event',
|
|
properties: {
|
|
handlers: [
|
|
{
|
|
type: 'onClick',
|
|
componentId: 'input1',
|
|
method: {
|
|
name: 'setInputValue',
|
|
parameters: {
|
|
value: '666',
|
|
},
|
|
},
|
|
},
|
|
{
|
|
type: 'onClick',
|
|
componentId: 'input2',
|
|
method: {
|
|
name: 'setInputValue',
|
|
parameters: {
|
|
value: '666',
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
];
|