import { Snippet } from '@alilc/lowcode-types';

export const snippets: Snippet[] = [
  {
    title: '卡片',
    screenshot:
      'https://img.alicdn.com/imgextra/i4/O1CN01qjZnGj1OW8lpLCQqm_!!6000000001712-55-tps-56-56.svg',
    schema: {
      componentName: 'ProCard',
      props: {
        title: '标题',
        extra: {
          type: 'JSSlot',
          value: [
            {
              componentName: 'Slot',
              id: 'node_ocl68ivyol1',
              props: {},
              docId: 'docl68ivyo2l',
              params: ['currentPageData'],
              hidden: false,
              title: '',
              isLocked: false,
              condition: true,
              conditionGroup: '',
              children: [
                {
                  componentName: 'Button',
                  id: 'node_ocl68ivsf3el',
                  props: {
                    type: 'primary',
                    children: '新增',
                    htmlType: 'button',
                    size: 'middle',
                    shape: 'default',
                    icon: {
                      type: 'JSSlot',
                      value: [
                        {
                          componentName: 'Slot',
                          id: 'node_ocl684ivyol5',
                          props: {},
                          docId: 'docl68i5yol',
                          hidden: false,
                          title: '',
                          isLocked: false,
                          condition: true,
                          conditionGroup: '',
                          children: [
                            {
                              componentName: 'Icon',
                              id: 'node_6ocl68ivsfeo',
                              props: {
                                type: 'PlusOutlined',
                                size: 16,
                                rotate: 0,
                                spin: false,
                              },
                              docId: 'docl678ivyol',
                              hidden: false,
                              title: '',
                              isLocked: false,
                              condition: true,
                              conditionGroup: '',
                            },
                          ],
                        },
                      ],
                    },
                    block: false,
                    danger: false,
                    ghost: false,
                    disabled: false,
                    __events: {
                      eventDataList: [
                        {
                          type: 'componentEvent',
                          name: 'onClick',
                          relatedEventName: 'openAddModal',
                        },
                      ],
                      eventList: [
                        {
                          name: 'onClick',
                          template:
                            "onClick(event,${extParams}){\n// 点击按钮时的回调\nconsole.log('onClick', event);}",
                          disabled: true,
                        },
                      ],
                    },
                    onClick: {
                      type: 'JSFunction',
                      value:
                        'function(){this.openAddModal.apply(this,Array.prototype.slice.call(arguments).concat([])) }',
                    },
                  },
                  docId: 'docl68iv3yol',
                  hidden: false,
                  title: '',
                  isLocked: false,
                  condition: true,
                  conditionGroup: '',
                },
              ],
            },
          ],
        },
      },
    },
  },
];
