amis-editor 4.1.0-beta.1 → 4.1.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component/Breadcrumb.d.ts +23 -2
 - package/dist/component/Editor.d.ts +19 -0
 - package/dist/component/Panel/RenderersPanel.d.ts +1 -2
 - package/dist/component/RegionWrapper.d.ts +14 -7
 - package/dist/component/RendererThumb.d.ts +5 -5
 - package/dist/component/VRenderer.d.ts +4 -0
 - package/dist/component/base/SearchCustomRendererPanel.d.ts +15 -0
 - package/dist/component/base/SearchPanel.d.ts +83 -0
 - package/dist/component/base/SearchRendererPanel.d.ts +2 -42
 - package/dist/exports.min.js +1 -1
 - package/dist/index.d.ts +4 -1
 - package/dist/index.min.js +1 -1
 - package/dist/manager.d.ts +14 -3
 - package/dist/plugin/Card.d.ts +1 -0
 - package/dist/plugin/Cards.d.ts +1 -0
 - package/dist/plugin/Carousel.d.ts +1 -0
 - package/dist/plugin/Chart.d.ts +1 -0
 - package/dist/plugin/Collapse.d.ts +1 -0
 - package/dist/plugin/Custom.d.ts +3 -0
 - package/dist/plugin/CustomRegion.d.ts +43 -0
 - package/dist/plugin/Flex.d.ts +1 -0
 - package/dist/plugin/Form/Control.d.ts +1 -0
 - package/dist/plugin/Form/InputURL.d.ts +1 -0
 - package/dist/plugin/Grid.d.ts +1 -0
 - package/dist/plugin/HBox.d.ts +1 -0
 - package/dist/plugin/Json.d.ts +1 -0
 - package/dist/plugin/List.d.ts +1 -0
 - package/dist/plugin/Mapping.d.ts +1 -0
 - package/dist/plugin/Markdown.d.ts +1 -0
 - package/dist/plugin/Nav.d.ts +1 -0
 - package/dist/plugin/Panel/Outline.d.ts +8 -0
 - package/dist/plugin/Progress.d.ts +1 -0
 - package/dist/plugin/QRCode.d.ts +1 -0
 - package/dist/plugin/Reset.d.ts +0 -1
 - package/dist/plugin/Service.d.ts +1 -0
 - package/dist/plugin/Sparkline.d.ts +1 -0
 - package/dist/plugin/Status.d.ts +1 -0
 - package/dist/plugin/Steps.d.ts +1 -0
 - package/dist/plugin/Submit.d.ts +0 -1
 - package/dist/plugin/TableView.d.ts +1 -0
 - package/dist/plugin/Tasks.d.ts +1 -0
 - package/dist/plugin/TooltipWrapper.d.ts +1 -0
 - package/dist/plugin/Video.d.ts +1 -0
 - package/dist/plugin/WebComponent.d.ts +1 -0
 - package/dist/plugin/Wrapper.d.ts +1 -0
 - package/dist/plugin.d.ts +2 -2
 - package/dist/store/editor.d.ts +20 -2
 - package/dist/store/node.d.ts +6 -0
 - package/dist/style.css +1 -1
 - package/dist/util.d.ts +7 -2
 - package/package.json +6 -3
 - package/src/component/schemaTpl.tsx +2155 -0
 - package/src/plugin/.DS_Store +0 -0
 - package/src/plugin/Alert.tsx +87 -0
 - package/src/plugin/AnchorNav.tsx +233 -0
 - package/src/plugin/Audio.tsx +161 -0
 - package/src/plugin/Avatar.tsx +77 -0
 - package/src/plugin/Breadcrumb.tsx +107 -0
 - package/src/plugin/Button.tsx +283 -0
 - package/src/plugin/ButtonGroup.tsx +88 -0
 - package/src/plugin/ButtonToolbar.tsx +89 -0
 - package/src/plugin/CRUD.tsx +1832 -0
 - package/src/plugin/Card.tsx +290 -0
 - package/src/plugin/Cards.tsx +315 -0
 - package/src/plugin/Carousel.tsx +386 -0
 - package/src/plugin/Chart.tsx +218 -0
 - package/src/plugin/CodeView.tsx +60 -0
 - package/src/plugin/Collapse.tsx +143 -0
 - package/src/plugin/CollapseGroup.tsx +167 -0
 - package/src/plugin/Container.tsx +44 -0
 - package/src/plugin/Custom.tsx +128 -0
 - package/src/plugin/CustomRegion.tsx +150 -0
 - package/src/plugin/Date.tsx +81 -0
 - package/src/plugin/Datetime.tsx +75 -0
 - package/src/plugin/Dialog.tsx +178 -0
 - package/src/plugin/Divider.tsx +36 -0
 - package/src/plugin/Drawer.tsx +217 -0
 - package/src/plugin/DropDownButton.tsx +234 -0
 - package/src/plugin/Each.tsx +152 -0
 - package/src/plugin/ErrorRenderer.tsx +15 -0
 - package/src/plugin/Flex.tsx +156 -0
 - package/src/plugin/Form/ButtonGroupSelect.tsx +86 -0
 - package/src/plugin/Form/ButtonToolbar.tsx +121 -0
 - package/src/plugin/Form/ChainedSelect.tsx +70 -0
 - package/src/plugin/Form/Checkbox.tsx +87 -0
 - package/src/plugin/Form/Checkboxes.tsx +167 -0
 - package/src/plugin/Form/CodeEditor.tsx +91 -0
 - package/src/plugin/Form/Combo.tsx +582 -0
 - package/src/plugin/Form/ConditionBuilder.tsx +324 -0
 - package/src/plugin/Form/Control.tsx +139 -0
 - package/src/plugin/Form/DiffEditor.tsx +117 -0
 - package/src/plugin/Form/FieldSet.tsx +175 -0
 - package/src/plugin/Form/Form.tsx +692 -0
 - package/src/plugin/Form/Formula.tsx +91 -0
 - package/src/plugin/Form/Group.tsx +300 -0
 - package/src/plugin/Form/Hidden.tsx +56 -0
 - package/src/plugin/Form/InputArray.tsx +228 -0
 - package/src/plugin/Form/InputCity.tsx +93 -0
 - package/src/plugin/Form/InputColor.tsx +123 -0
 - package/src/plugin/Form/InputDate.tsx +175 -0
 - package/src/plugin/Form/InputDateRange.tsx +225 -0
 - package/src/plugin/Form/InputDateTime.tsx +183 -0
 - package/src/plugin/Form/InputDateTimeRange.tsx +221 -0
 - package/src/plugin/Form/InputEmail.tsx +33 -0
 - package/src/plugin/Form/InputExcel.tsx +85 -0
 - package/src/plugin/Form/InputFile.tsx +228 -0
 - package/src/plugin/Form/InputGroup.tsx +105 -0
 - package/src/plugin/Form/InputImage.tsx +277 -0
 - package/src/plugin/Form/InputKV.tsx +72 -0
 - package/src/plugin/Form/InputMonth.tsx +35 -0
 - package/src/plugin/Form/InputMonthRange.tsx +195 -0
 - package/src/plugin/Form/InputNumber.tsx +97 -0
 - package/src/plugin/Form/InputPassword.tsx +33 -0
 - package/src/plugin/Form/InputQuarter.tsx +35 -0
 - package/src/plugin/Form/InputQuarterRange.tsx +195 -0
 - package/src/plugin/Form/InputRange.tsx +121 -0
 - package/src/plugin/Form/InputRating.tsx +78 -0
 - package/src/plugin/Form/InputRepeat.tsx +69 -0
 - package/src/plugin/Form/InputRichText.tsx +197 -0
 - package/src/plugin/Form/InputSubForm.tsx +198 -0
 - package/src/plugin/Form/InputTable.tsx +434 -0
 - package/src/plugin/Form/InputTag.tsx +81 -0
 - package/src/plugin/Form/InputText.tsx +186 -0
 - package/src/plugin/Form/InputTime.tsx +95 -0
 - package/src/plugin/Form/InputTree.tsx +240 -0
 - package/src/plugin/Form/InputURL.tsx +34 -0
 - package/src/plugin/Form/InputYear.tsx +35 -0
 - package/src/plugin/Form/Item.tsx +325 -0
 - package/src/plugin/Form/ListSelect.tsx +84 -0
 - package/src/plugin/Form/LocationPicker.tsx +75 -0
 - package/src/plugin/Form/MatrixCheckboxes.tsx +147 -0
 - package/src/plugin/Form/NestedSelect.tsx +222 -0
 - package/src/plugin/Form/Picker.tsx +217 -0
 - package/src/plugin/Form/Radios.tsx +130 -0
 - package/src/plugin/Form/Select.tsx +216 -0
 - package/src/plugin/Form/Static.tsx +335 -0
 - package/src/plugin/Form/Switch.tsx +116 -0
 - package/src/plugin/Form/TabsTransfer.tsx +270 -0
 - package/src/plugin/Form/Textarea.tsx +94 -0
 - package/src/plugin/Form/Transfer.tsx +379 -0
 - package/src/plugin/Form/TreeSelect.tsx +263 -0
 - package/src/plugin/Form/UUID.tsx +48 -0
 - package/src/plugin/Grid.tsx +799 -0
 - package/src/plugin/HBox.tsx +727 -0
 - package/src/plugin/IFrame.tsx +72 -0
 - package/src/plugin/Image.tsx +318 -0
 - package/src/plugin/Images.tsx +238 -0
 - package/src/plugin/Json.tsx +76 -0
 - package/src/plugin/Link.tsx +95 -0
 - package/src/plugin/List.tsx +278 -0
 - package/src/plugin/ListItem.tsx +233 -0
 - package/src/plugin/Log.tsx +52 -0
 - package/src/plugin/Mapping.tsx +156 -0
 - package/src/plugin/Markdown.tsx +47 -0
 - package/src/plugin/Nav.tsx +186 -0
 - package/src/plugin/Operation.tsx +97 -0
 - package/src/plugin/Others/Action.tsx +428 -0
 - package/src/plugin/Others/BasicToolbar.tsx +591 -0
 - package/src/plugin/Others/DataDebug.tsx +134 -0
 - package/src/plugin/Others/TableCell.tsx +480 -0
 - package/src/plugin/Others/Unknown.tsx +37 -0
 - package/src/plugin/Page.tsx +308 -0
 - package/src/plugin/Panel/AvailableRenderers.tsx +41 -0
 - package/src/plugin/Panel/Code.tsx +44 -0
 - package/src/plugin/Panel/Name.tsx +26 -0
 - package/src/plugin/Panel/Outline.tsx +40 -0
 - package/src/plugin/Panel.tsx +243 -0
 - package/src/plugin/Plain.tsx +91 -0
 - package/src/plugin/Progress.tsx +132 -0
 - package/src/plugin/Property.tsx +139 -0
 - package/src/plugin/QRCode.tsx +98 -0
 - package/src/plugin/Reset.tsx +23 -0
 - package/src/plugin/Service.tsx +167 -0
 - package/src/plugin/Sparkline.tsx +40 -0
 - package/src/plugin/Status.tsx +78 -0
 - package/src/plugin/Steps.tsx +140 -0
 - package/src/plugin/Submit.tsx +23 -0
 - package/src/plugin/Table.tsx +440 -0
 - package/src/plugin/TableView.tsx +711 -0
 - package/src/plugin/Tabs.tsx +364 -0
 - package/src/plugin/Tasks.tsx +276 -0
 - package/src/plugin/Time.tsx +75 -0
 - package/src/plugin/TooltipWrapper.tsx +193 -0
 - package/src/plugin/Tpl.tsx +162 -0
 - package/src/plugin/Video.tsx +160 -0
 - package/src/plugin/WebComponent.tsx +56 -0
 - package/src/plugin/Wizard.tsx +743 -0
 - package/src/plugin/Wrapper.tsx +107 -0
 - package/src/plugin.ts +1046 -0
 - package/dist/150a58f3318ca7541ed9.png +0 -0
 - package/dist/471adb97c322b226e589.png +0 -0
 - package/dist/4de5f42360bc5946c3c2.png +0 -0
 - package/dist/4e9968bba3855f088fed.png +0 -0
 - package/dist/7f09c38ebc687fea847a.png +0 -0
 - package/dist/c94073576487510314ea.png +0 -0
 
| 
         @@ -0,0 +1,95 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import {Button, SchemaObject} from 'amis';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import React from 'react';
         
     | 
| 
      
 3 
     | 
    
         
            +
            import {registerEditorPlugin} from '../manager';
         
     | 
| 
      
 4 
     | 
    
         
            +
            import {BasePlugin, RegionConfig, RendererInfo} from '../plugin';
         
     | 
| 
      
 5 
     | 
    
         
            +
            import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            export class LinkPlugin extends BasePlugin {
         
     | 
| 
      
 8 
     | 
    
         
            +
              // 关联渲染器名字
         
     | 
| 
      
 9 
     | 
    
         
            +
              rendererName = 'link';
         
     | 
| 
      
 10 
     | 
    
         
            +
              $schema = '/schemas/LinkSchema.json';
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              // 组件名称
         
     | 
| 
      
 13 
     | 
    
         
            +
              name = '链接';
         
     | 
| 
      
 14 
     | 
    
         
            +
              isBaseComponent = true;
         
     | 
| 
      
 15 
     | 
    
         
            +
              description = '用来展示文字链接';
         
     | 
| 
      
 16 
     | 
    
         
            +
              tags = ['展示'];
         
     | 
| 
      
 17 
     | 
    
         
            +
              icon = 'fa fa-link';
         
     | 
| 
      
 18 
     | 
    
         
            +
              scaffold = {
         
     | 
| 
      
 19 
     | 
    
         
            +
                type: 'link',
         
     | 
| 
      
 20 
     | 
    
         
            +
                value: 'http://www.baidu.com/'
         
     | 
| 
      
 21 
     | 
    
         
            +
              };
         
     | 
| 
      
 22 
     | 
    
         
            +
              previewSchema = {
         
     | 
| 
      
 23 
     | 
    
         
            +
                ...this.scaffold,
         
     | 
| 
      
 24 
     | 
    
         
            +
                label: this.name
         
     | 
| 
      
 25 
     | 
    
         
            +
              };
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              panelTitle = '链接';
         
     | 
| 
      
 28 
     | 
    
         
            +
              panelBody = [
         
     | 
| 
      
 29 
     | 
    
         
            +
                getSchemaTpl('tabs', [
         
     | 
| 
      
 30 
     | 
    
         
            +
                  {
         
     | 
| 
      
 31 
     | 
    
         
            +
                    title: '常规',
         
     | 
| 
      
 32 
     | 
    
         
            +
                    body: [
         
     | 
| 
      
 33 
     | 
    
         
            +
                      {
         
     | 
| 
      
 34 
     | 
    
         
            +
                        name: 'href',
         
     | 
| 
      
 35 
     | 
    
         
            +
                        type: 'input-text',
         
     | 
| 
      
 36 
     | 
    
         
            +
                        label: '目标地址, 支持取变量。',
         
     | 
| 
      
 37 
     | 
    
         
            +
                        description: '如果已绑定字段名,可以不用设置'
         
     | 
| 
      
 38 
     | 
    
         
            +
                      },
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                      {
         
     | 
| 
      
 41 
     | 
    
         
            +
                        name: 'body',
         
     | 
| 
      
 42 
     | 
    
         
            +
                        type: 'input-text',
         
     | 
| 
      
 43 
     | 
    
         
            +
                        label: '内容',
         
     | 
| 
      
 44 
     | 
    
         
            +
                        description: '不填写时,自动使用目标地址值'
         
     | 
| 
      
 45 
     | 
    
         
            +
                      },
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                      {
         
     | 
| 
      
 48 
     | 
    
         
            +
                        name: 'blank',
         
     | 
| 
      
 49 
     | 
    
         
            +
                        type: 'switch',
         
     | 
| 
      
 50 
     | 
    
         
            +
                        label: '是否新窗口打开',
         
     | 
| 
      
 51 
     | 
    
         
            +
                        mode: 'inline',
         
     | 
| 
      
 52 
     | 
    
         
            +
                        className: 'w-full'
         
     | 
| 
      
 53 
     | 
    
         
            +
                      },
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                      {
         
     | 
| 
      
 56 
     | 
    
         
            +
                        name: 'disabled',
         
     | 
| 
      
 57 
     | 
    
         
            +
                        type: 'switch',
         
     | 
| 
      
 58 
     | 
    
         
            +
                        label: '是否禁用',
         
     | 
| 
      
 59 
     | 
    
         
            +
                        mode: 'inline',
         
     | 
| 
      
 60 
     | 
    
         
            +
                        className: 'w-full'
         
     | 
| 
      
 61 
     | 
    
         
            +
                      },
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                      {
         
     | 
| 
      
 64 
     | 
    
         
            +
                        name: 'htmlTarget',
         
     | 
| 
      
 65 
     | 
    
         
            +
                        type: 'input-text',
         
     | 
| 
      
 66 
     | 
    
         
            +
                        label: 'HTML Target'
         
     | 
| 
      
 67 
     | 
    
         
            +
                      },
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
                      getSchemaTpl('icon', {
         
     | 
| 
      
 70 
     | 
    
         
            +
                        label: '左侧图标'
         
     | 
| 
      
 71 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                      getSchemaTpl('icon', {
         
     | 
| 
      
 74 
     | 
    
         
            +
                        label: '右侧图标',
         
     | 
| 
      
 75 
     | 
    
         
            +
                        name: 'rightIcon'
         
     | 
| 
      
 76 
     | 
    
         
            +
                      })
         
     | 
| 
      
 77 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 78 
     | 
    
         
            +
                  },
         
     | 
| 
      
 79 
     | 
    
         
            +
                  {
         
     | 
| 
      
 80 
     | 
    
         
            +
                    title: '外观',
         
     | 
| 
      
 81 
     | 
    
         
            +
                    body: [
         
     | 
| 
      
 82 
     | 
    
         
            +
                      getSchemaTpl('className', {
         
     | 
| 
      
 83 
     | 
    
         
            +
                        autoComplete: false
         
     | 
| 
      
 84 
     | 
    
         
            +
                      })
         
     | 
| 
      
 85 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 86 
     | 
    
         
            +
                  },
         
     | 
| 
      
 87 
     | 
    
         
            +
                  {
         
     | 
| 
      
 88 
     | 
    
         
            +
                    title: '显隐',
         
     | 
| 
      
 89 
     | 
    
         
            +
                    body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
         
     | 
| 
      
 90 
     | 
    
         
            +
                  }
         
     | 
| 
      
 91 
     | 
    
         
            +
                ])
         
     | 
| 
      
 92 
     | 
    
         
            +
              ];
         
     | 
| 
      
 93 
     | 
    
         
            +
            }
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
            registerEditorPlugin(LinkPlugin);
         
     | 
| 
         @@ -0,0 +1,278 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import {Button, resolveVariable, SchemaObject} from 'amis';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import React from 'react';
         
     | 
| 
      
 3 
     | 
    
         
            +
            import {registerEditorPlugin} from '../manager';
         
     | 
| 
      
 4 
     | 
    
         
            +
            import {
         
     | 
| 
      
 5 
     | 
    
         
            +
              BaseEventContext,
         
     | 
| 
      
 6 
     | 
    
         
            +
              BasePlugin,
         
     | 
| 
      
 7 
     | 
    
         
            +
              BasicPanelItem,
         
     | 
| 
      
 8 
     | 
    
         
            +
              BasicRendererInfo,
         
     | 
| 
      
 9 
     | 
    
         
            +
              BasicToolbarItem,
         
     | 
| 
      
 10 
     | 
    
         
            +
              ContextMenuEventContext,
         
     | 
| 
      
 11 
     | 
    
         
            +
              ContextMenuItem,
         
     | 
| 
      
 12 
     | 
    
         
            +
              PluginInterface,
         
     | 
| 
      
 13 
     | 
    
         
            +
              RegionConfig,
         
     | 
| 
      
 14 
     | 
    
         
            +
              RendererInfo,
         
     | 
| 
      
 15 
     | 
    
         
            +
              RendererInfoResolveEventContext
         
     | 
| 
      
 16 
     | 
    
         
            +
            } from '../plugin';
         
     | 
| 
      
 17 
     | 
    
         
            +
            import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
         
     | 
| 
      
 18 
     | 
    
         
            +
            import {diff, JSONPipeOut, repeatArray} from '../util';
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            export class ListPlugin extends BasePlugin {
         
     | 
| 
      
 21 
     | 
    
         
            +
              // 关联渲染器名字
         
     | 
| 
      
 22 
     | 
    
         
            +
              rendererName = 'list';
         
     | 
| 
      
 23 
     | 
    
         
            +
              $schema = '/schemas/ListSchema.json';
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              // 组件名称
         
     | 
| 
      
 26 
     | 
    
         
            +
              name = '列表';
         
     | 
| 
      
 27 
     | 
    
         
            +
              isBaseComponent = true;
         
     | 
| 
      
 28 
     | 
    
         
            +
              description =
         
     | 
| 
      
 29 
     | 
    
         
            +
                '展示一个列表,可以自定标题、副标题,内容及按钮组部分。当前组件需要配置数据源,不自带数据拉取,请优先使用 「CRUD」 组件。';
         
     | 
| 
      
 30 
     | 
    
         
            +
              docLink = '/amis/zh-CN/components/list';
         
     | 
| 
      
 31 
     | 
    
         
            +
              tags = ['展示'];
         
     | 
| 
      
 32 
     | 
    
         
            +
              icon = 'fa fa-list';
         
     | 
| 
      
 33 
     | 
    
         
            +
              scaffold = {
         
     | 
| 
      
 34 
     | 
    
         
            +
                type: 'list',
         
     | 
| 
      
 35 
     | 
    
         
            +
                listItem: {
         
     | 
| 
      
 36 
     | 
    
         
            +
                  body: [
         
     | 
| 
      
 37 
     | 
    
         
            +
                    {
         
     | 
| 
      
 38 
     | 
    
         
            +
                      type: 'tpl',
         
     | 
| 
      
 39 
     | 
    
         
            +
                      tpl: '简单的展示数据:$a $b'
         
     | 
| 
      
 40 
     | 
    
         
            +
                    }
         
     | 
| 
      
 41 
     | 
    
         
            +
                  ],
         
     | 
| 
      
 42 
     | 
    
         
            +
                  actions: [
         
     | 
| 
      
 43 
     | 
    
         
            +
                    {
         
     | 
| 
      
 44 
     | 
    
         
            +
                      icon: 'fa fa-eye',
         
     | 
| 
      
 45 
     | 
    
         
            +
                      type: 'button'
         
     | 
| 
      
 46 
     | 
    
         
            +
                    }
         
     | 
| 
      
 47 
     | 
    
         
            +
                  ]
         
     | 
| 
      
 48 
     | 
    
         
            +
                }
         
     | 
| 
      
 49 
     | 
    
         
            +
              };
         
     | 
| 
      
 50 
     | 
    
         
            +
              previewSchema = {
         
     | 
| 
      
 51 
     | 
    
         
            +
                ...this.scaffold,
         
     | 
| 
      
 52 
     | 
    
         
            +
                items: [
         
     | 
| 
      
 53 
     | 
    
         
            +
                  {a: 1, b: 2},
         
     | 
| 
      
 54 
     | 
    
         
            +
                  {a: 3, b: 4},
         
     | 
| 
      
 55 
     | 
    
         
            +
                  {a: 5, b: 6}
         
     | 
| 
      
 56 
     | 
    
         
            +
                ]
         
     | 
| 
      
 57 
     | 
    
         
            +
              };
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
              panelTitle = '列表';
         
     | 
| 
      
 60 
     | 
    
         
            +
              panelBodyCreator = (context: BaseEventContext) => {
         
     | 
| 
      
 61 
     | 
    
         
            +
                const isCRUDBody = context.schema.type === 'crud';
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                return getSchemaTpl('tabs', [
         
     | 
| 
      
 64 
     | 
    
         
            +
                  {
         
     | 
| 
      
 65 
     | 
    
         
            +
                    title: '常规',
         
     | 
| 
      
 66 
     | 
    
         
            +
                    body: [
         
     | 
| 
      
 67 
     | 
    
         
            +
                      {
         
     | 
| 
      
 68 
     | 
    
         
            +
                        children: (
         
     | 
| 
      
 69 
     | 
    
         
            +
                          <Button
         
     | 
| 
      
 70 
     | 
    
         
            +
                            level="danger"
         
     | 
| 
      
 71 
     | 
    
         
            +
                            size="sm"
         
     | 
| 
      
 72 
     | 
    
         
            +
                            block
         
     | 
| 
      
 73 
     | 
    
         
            +
                            onClick={this.editDetail.bind(this, context.id)}
         
     | 
| 
      
 74 
     | 
    
         
            +
                          >
         
     | 
| 
      
 75 
     | 
    
         
            +
                            配置成员详情
         
     | 
| 
      
 76 
     | 
    
         
            +
                          </Button>
         
     | 
| 
      
 77 
     | 
    
         
            +
                        )
         
     | 
| 
      
 78 
     | 
    
         
            +
                      },
         
     | 
| 
      
 79 
     | 
    
         
            +
                      {
         
     | 
| 
      
 80 
     | 
    
         
            +
                        type: 'divider'
         
     | 
| 
      
 81 
     | 
    
         
            +
                      },
         
     | 
| 
      
 82 
     | 
    
         
            +
                      {
         
     | 
| 
      
 83 
     | 
    
         
            +
                        name: 'title',
         
     | 
| 
      
 84 
     | 
    
         
            +
                        type: 'input-text',
         
     | 
| 
      
 85 
     | 
    
         
            +
                        label: '标题'
         
     | 
| 
      
 86 
     | 
    
         
            +
                      },
         
     | 
| 
      
 87 
     | 
    
         
            +
                      isCRUDBody
         
     | 
| 
      
 88 
     | 
    
         
            +
                        ? null
         
     | 
| 
      
 89 
     | 
    
         
            +
                        : {
         
     | 
| 
      
 90 
     | 
    
         
            +
                            name: 'source',
         
     | 
| 
      
 91 
     | 
    
         
            +
                            type: 'input-text',
         
     | 
| 
      
 92 
     | 
    
         
            +
                            label: '数据源',
         
     | 
| 
      
 93 
     | 
    
         
            +
                            pipeIn: defaultValue('${items}'),
         
     | 
| 
      
 94 
     | 
    
         
            +
                            description: '绑定当前环境变量'
         
     | 
| 
      
 95 
     | 
    
         
            +
                          },
         
     | 
| 
      
 96 
     | 
    
         
            +
                      {
         
     | 
| 
      
 97 
     | 
    
         
            +
                        name: 'placeholder',
         
     | 
| 
      
 98 
     | 
    
         
            +
                        pipeIn: defaultValue('没有数据'),
         
     | 
| 
      
 99 
     | 
    
         
            +
                        type: 'input-text',
         
     | 
| 
      
 100 
     | 
    
         
            +
                        label: '无数据提示'
         
     | 
| 
      
 101 
     | 
    
         
            +
                      }
         
     | 
| 
      
 102 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 103 
     | 
    
         
            +
                  },
         
     | 
| 
      
 104 
     | 
    
         
            +
                  {
         
     | 
| 
      
 105 
     | 
    
         
            +
                    title: '外观',
         
     | 
| 
      
 106 
     | 
    
         
            +
                    body: [
         
     | 
| 
      
 107 
     | 
    
         
            +
                      {
         
     | 
| 
      
 108 
     | 
    
         
            +
                        name: 'showHeader',
         
     | 
| 
      
 109 
     | 
    
         
            +
                        type: 'switch',
         
     | 
| 
      
 110 
     | 
    
         
            +
                        mode: 'inline',
         
     | 
| 
      
 111 
     | 
    
         
            +
                        className: 'block',
         
     | 
| 
      
 112 
     | 
    
         
            +
                        label: '是否显示头部',
         
     | 
| 
      
 113 
     | 
    
         
            +
                        pipeIn: defaultValue(true)
         
     | 
| 
      
 114 
     | 
    
         
            +
                      },
         
     | 
| 
      
 115 
     | 
    
         
            +
                      {
         
     | 
| 
      
 116 
     | 
    
         
            +
                        name: 'showFooter',
         
     | 
| 
      
 117 
     | 
    
         
            +
                        type: 'switch',
         
     | 
| 
      
 118 
     | 
    
         
            +
                        mode: 'inline',
         
     | 
| 
      
 119 
     | 
    
         
            +
                        className: 'block',
         
     | 
| 
      
 120 
     | 
    
         
            +
                        label: '是否显示底部',
         
     | 
| 
      
 121 
     | 
    
         
            +
                        pipeIn: defaultValue(true)
         
     | 
| 
      
 122 
     | 
    
         
            +
                      },
         
     | 
| 
      
 123 
     | 
    
         
            +
                      getSchemaTpl('className', {
         
     | 
| 
      
 124 
     | 
    
         
            +
                        label: 'CSS 类名'
         
     | 
| 
      
 125 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 126 
     | 
    
         
            +
                      getSchemaTpl('className', {
         
     | 
| 
      
 127 
     | 
    
         
            +
                        name: 'listClassName',
         
     | 
| 
      
 128 
     | 
    
         
            +
                        label: 'List div CSS 类名'
         
     | 
| 
      
 129 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 130 
     | 
    
         
            +
                      getSchemaTpl('className', {
         
     | 
| 
      
 131 
     | 
    
         
            +
                        name: 'headerClassName',
         
     | 
| 
      
 132 
     | 
    
         
            +
                        label: '头部 CSS 类名'
         
     | 
| 
      
 133 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 134 
     | 
    
         
            +
                      getSchemaTpl('className', {
         
     | 
| 
      
 135 
     | 
    
         
            +
                        name: 'footerClassName',
         
     | 
| 
      
 136 
     | 
    
         
            +
                        label: '底部 CSS 类名'
         
     | 
| 
      
 137 
     | 
    
         
            +
                      })
         
     | 
| 
      
 138 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 139 
     | 
    
         
            +
                  },
         
     | 
| 
      
 140 
     | 
    
         
            +
                  {
         
     | 
| 
      
 141 
     | 
    
         
            +
                    title: '显隐',
         
     | 
| 
      
 142 
     | 
    
         
            +
                    body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
         
     | 
| 
      
 143 
     | 
    
         
            +
                  }
         
     | 
| 
      
 144 
     | 
    
         
            +
                ]);
         
     | 
| 
      
 145 
     | 
    
         
            +
              };
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
              filterProps(props: any) {
         
     | 
| 
      
 148 
     | 
    
         
            +
                if (props.isSlot) {
         
     | 
| 
      
 149 
     | 
    
         
            +
                  props.value = [props.data];
         
     | 
| 
      
 150 
     | 
    
         
            +
                  return props;
         
     | 
| 
      
 151 
     | 
    
         
            +
                }
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
                const data = {
         
     | 
| 
      
 154 
     | 
    
         
            +
                  ...props.defaultData,
         
     | 
| 
      
 155 
     | 
    
         
            +
                  ...props.data
         
     | 
| 
      
 156 
     | 
    
         
            +
                };
         
     | 
| 
      
 157 
     | 
    
         
            +
                let arr = Array.isArray(props.value)
         
     | 
| 
      
 158 
     | 
    
         
            +
                  ? props.value
         
     | 
| 
      
 159 
     | 
    
         
            +
                  : typeof props.source === 'string'
         
     | 
| 
      
 160 
     | 
    
         
            +
                  ? resolveVariable(props.source, data)
         
     | 
| 
      
 161 
     | 
    
         
            +
                  : resolveVariable('items', data);
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
                if (!Array.isArray(arr) || !arr.length) {
         
     | 
| 
      
 164 
     | 
    
         
            +
                  const mockedData: any = this.buildMockData();
         
     | 
| 
      
 165 
     | 
    
         
            +
                  props.value = repeatArray(mockedData, 1).map((item, index) => ({
         
     | 
| 
      
 166 
     | 
    
         
            +
                    ...item,
         
     | 
| 
      
 167 
     | 
    
         
            +
                    id: index + 1
         
     | 
| 
      
 168 
     | 
    
         
            +
                  }));
         
     | 
| 
      
 169 
     | 
    
         
            +
                }
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
                const {$schema, ...rest} = props;
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
                return {
         
     | 
| 
      
 174 
     | 
    
         
            +
                  ...JSONPipeOut(rest),
         
     | 
| 
      
 175 
     | 
    
         
            +
                  $schema
         
     | 
| 
      
 176 
     | 
    
         
            +
                };
         
     | 
| 
      
 177 
     | 
    
         
            +
              }
         
     | 
| 
      
 178 
     | 
    
         
            +
             
     | 
| 
      
 179 
     | 
    
         
            +
              buildMockData() {
         
     | 
| 
      
 180 
     | 
    
         
            +
                return {
         
     | 
| 
      
 181 
     | 
    
         
            +
                  id: 666,
         
     | 
| 
      
 182 
     | 
    
         
            +
                  title: '假数据',
         
     | 
| 
      
 183 
     | 
    
         
            +
                  description: '假数据',
         
     | 
| 
      
 184 
     | 
    
         
            +
                  a: '假数据',
         
     | 
| 
      
 185 
     | 
    
         
            +
                  b: '假数据'
         
     | 
| 
      
 186 
     | 
    
         
            +
                };
         
     | 
| 
      
 187 
     | 
    
         
            +
              }
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
              editDetail(id: string) {
         
     | 
| 
      
 190 
     | 
    
         
            +
                const manager = this.manager;
         
     | 
| 
      
 191 
     | 
    
         
            +
                const store = manager.store;
         
     | 
| 
      
 192 
     | 
    
         
            +
                const node = store.getNodeById(id);
         
     | 
| 
      
 193 
     | 
    
         
            +
                const value = store.getValueOf(id);
         
     | 
| 
      
 194 
     | 
    
         
            +
             
     | 
| 
      
 195 
     | 
    
         
            +
                node &&
         
     | 
| 
      
 196 
     | 
    
         
            +
                  value &&
         
     | 
| 
      
 197 
     | 
    
         
            +
                  this.manager.openSubEditor({
         
     | 
| 
      
 198 
     | 
    
         
            +
                    title: '配置成员详情',
         
     | 
| 
      
 199 
     | 
    
         
            +
                    value: {
         
     | 
| 
      
 200 
     | 
    
         
            +
                      ...value.listItem
         
     | 
| 
      
 201 
     | 
    
         
            +
                    },
         
     | 
| 
      
 202 
     | 
    
         
            +
                    slot: {
         
     | 
| 
      
 203 
     | 
    
         
            +
                      type: 'list',
         
     | 
| 
      
 204 
     | 
    
         
            +
                      listItem: '$$'
         
     | 
| 
      
 205 
     | 
    
         
            +
                    },
         
     | 
| 
      
 206 
     | 
    
         
            +
                    onChange: newValue => {
         
     | 
| 
      
 207 
     | 
    
         
            +
                      newValue = {...value, listItem: newValue};
         
     | 
| 
      
 208 
     | 
    
         
            +
                      manager.panelChangeValue(newValue, diff(value, newValue));
         
     | 
| 
      
 209 
     | 
    
         
            +
                    },
         
     | 
| 
      
 210 
     | 
    
         
            +
                    data: {
         
     | 
| 
      
 211 
     | 
    
         
            +
                      // TODO  默认数据不对
         
     | 
| 
      
 212 
     | 
    
         
            +
                      items: [this.buildMockData()]
         
     | 
| 
      
 213 
     | 
    
         
            +
                    }
         
     | 
| 
      
 214 
     | 
    
         
            +
                  });
         
     | 
| 
      
 215 
     | 
    
         
            +
              }
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
      
 217 
     | 
    
         
            +
              buildEditorToolbar(
         
     | 
| 
      
 218 
     | 
    
         
            +
                {id, info, schema}: BaseEventContext,
         
     | 
| 
      
 219 
     | 
    
         
            +
                toolbars: Array<BasicToolbarItem>
         
     | 
| 
      
 220 
     | 
    
         
            +
              ) {
         
     | 
| 
      
 221 
     | 
    
         
            +
                if (
         
     | 
| 
      
 222 
     | 
    
         
            +
                  info.renderer.name === 'list' ||
         
     | 
| 
      
 223 
     | 
    
         
            +
                  (info.renderer.name === 'crud' && schema.mode === 'list')
         
     | 
| 
      
 224 
     | 
    
         
            +
                ) {
         
     | 
| 
      
 225 
     | 
    
         
            +
                  toolbars.push({
         
     | 
| 
      
 226 
     | 
    
         
            +
                    icon: 'fa fa-expand',
         
     | 
| 
      
 227 
     | 
    
         
            +
                    order: 100,
         
     | 
| 
      
 228 
     | 
    
         
            +
                    tooltip: '配置成员渲染器',
         
     | 
| 
      
 229 
     | 
    
         
            +
                    onClick: this.editDetail.bind(this, id)
         
     | 
| 
      
 230 
     | 
    
         
            +
                  });
         
     | 
| 
      
 231 
     | 
    
         
            +
                }
         
     | 
| 
      
 232 
     | 
    
         
            +
              }
         
     | 
| 
      
 233 
     | 
    
         
            +
             
     | 
| 
      
 234 
     | 
    
         
            +
              buildEditorContextMenu(
         
     | 
| 
      
 235 
     | 
    
         
            +
                {id, schema, region, info}: ContextMenuEventContext,
         
     | 
| 
      
 236 
     | 
    
         
            +
                menus: Array<ContextMenuItem>
         
     | 
| 
      
 237 
     | 
    
         
            +
              ) {
         
     | 
| 
      
 238 
     | 
    
         
            +
                if (
         
     | 
| 
      
 239 
     | 
    
         
            +
                  info.renderer.name === 'list' ||
         
     | 
| 
      
 240 
     | 
    
         
            +
                  (info.renderer.name === 'crud' && schema.mode === 'list')
         
     | 
| 
      
 241 
     | 
    
         
            +
                ) {
         
     | 
| 
      
 242 
     | 
    
         
            +
                  menus.push('|', {
         
     | 
| 
      
 243 
     | 
    
         
            +
                    label: '配置成员详情',
         
     | 
| 
      
 244 
     | 
    
         
            +
                    onSelect: this.editDetail.bind(this, id)
         
     | 
| 
      
 245 
     | 
    
         
            +
                  });
         
     | 
| 
      
 246 
     | 
    
         
            +
                }
         
     | 
| 
      
 247 
     | 
    
         
            +
              }
         
     | 
| 
      
 248 
     | 
    
         
            +
             
     | 
| 
      
 249 
     | 
    
         
            +
              // 为了能够自动注入数据。
         
     | 
| 
      
 250 
     | 
    
         
            +
              getRendererInfo(
         
     | 
| 
      
 251 
     | 
    
         
            +
                context: RendererInfoResolveEventContext
         
     | 
| 
      
 252 
     | 
    
         
            +
              ): BasicRendererInfo | void {
         
     | 
| 
      
 253 
     | 
    
         
            +
                const plugin: PluginInterface = this;
         
     | 
| 
      
 254 
     | 
    
         
            +
                const {renderer, schema} = context;
         
     | 
| 
      
 255 
     | 
    
         
            +
                if (
         
     | 
| 
      
 256 
     | 
    
         
            +
                  !schema.$$id &&
         
     | 
| 
      
 257 
     | 
    
         
            +
                  schema.$$editor?.renderer.name === 'crud' &&
         
     | 
| 
      
 258 
     | 
    
         
            +
                  renderer.name === 'list'
         
     | 
| 
      
 259 
     | 
    
         
            +
                ) {
         
     | 
| 
      
 260 
     | 
    
         
            +
                  return {
         
     | 
| 
      
 261 
     | 
    
         
            +
                    ...({id: schema.$$editor.id} as any),
         
     | 
| 
      
 262 
     | 
    
         
            +
                    name: plugin.name!,
         
     | 
| 
      
 263 
     | 
    
         
            +
                    regions: plugin.regions,
         
     | 
| 
      
 264 
     | 
    
         
            +
                    patchContainers: plugin.patchContainers,
         
     | 
| 
      
 265 
     | 
    
         
            +
                    vRendererConfig: plugin.vRendererConfig,
         
     | 
| 
      
 266 
     | 
    
         
            +
                    wrapperProps: plugin.wrapperProps,
         
     | 
| 
      
 267 
     | 
    
         
            +
                    wrapperResolve: plugin.wrapperResolve,
         
     | 
| 
      
 268 
     | 
    
         
            +
                    filterProps: plugin.filterProps,
         
     | 
| 
      
 269 
     | 
    
         
            +
                    $schema: plugin.$schema,
         
     | 
| 
      
 270 
     | 
    
         
            +
                    renderRenderer: plugin.renderRenderer
         
     | 
| 
      
 271 
     | 
    
         
            +
                  };
         
     | 
| 
      
 272 
     | 
    
         
            +
                }
         
     | 
| 
      
 273 
     | 
    
         
            +
             
     | 
| 
      
 274 
     | 
    
         
            +
                return super.getRendererInfo(context);
         
     | 
| 
      
 275 
     | 
    
         
            +
              }
         
     | 
| 
      
 276 
     | 
    
         
            +
            }
         
     | 
| 
      
 277 
     | 
    
         
            +
             
     | 
| 
      
 278 
     | 
    
         
            +
            registerEditorPlugin(ListPlugin);
         
     | 
| 
         @@ -0,0 +1,233 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import {Button, SchemaObject} from 'amis';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import React from 'react';
         
     | 
| 
      
 3 
     | 
    
         
            +
            import {registerEditorPlugin} from '../manager';
         
     | 
| 
      
 4 
     | 
    
         
            +
            import {
         
     | 
| 
      
 5 
     | 
    
         
            +
              BaseEventContext,
         
     | 
| 
      
 6 
     | 
    
         
            +
              BasePlugin,
         
     | 
| 
      
 7 
     | 
    
         
            +
              BasicPanelItem,
         
     | 
| 
      
 8 
     | 
    
         
            +
              BasicRendererInfo,
         
     | 
| 
      
 9 
     | 
    
         
            +
              InsertEventContext,
         
     | 
| 
      
 10 
     | 
    
         
            +
              PluginEvent,
         
     | 
| 
      
 11 
     | 
    
         
            +
              PluginInterface,
         
     | 
| 
      
 12 
     | 
    
         
            +
              RegionConfig,
         
     | 
| 
      
 13 
     | 
    
         
            +
              RendererInfo,
         
     | 
| 
      
 14 
     | 
    
         
            +
              RendererInfoResolveEventContext,
         
     | 
| 
      
 15 
     | 
    
         
            +
              VRendererConfig
         
     | 
| 
      
 16 
     | 
    
         
            +
            } from '../plugin';
         
     | 
| 
      
 17 
     | 
    
         
            +
            import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
         
     | 
| 
      
 18 
     | 
    
         
            +
            import {EditorNodeType} from '../store/node';
         
     | 
| 
      
 19 
     | 
    
         
            +
            import {VRenderer} from '../component/VRenderer';
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            export class ListItemPlugin extends BasePlugin {
         
     | 
| 
      
 22 
     | 
    
         
            +
              // 关联渲染器名字
         
     | 
| 
      
 23 
     | 
    
         
            +
              rendererName = 'list-item';
         
     | 
| 
      
 24 
     | 
    
         
            +
              isBaseComponent = true;
         
     | 
| 
      
 25 
     | 
    
         
            +
              $schema = '/schemas/ListItemSchema.json';
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              regions: Array<RegionConfig> = [
         
     | 
| 
      
 28 
     | 
    
         
            +
                {
         
     | 
| 
      
 29 
     | 
    
         
            +
                  key: 'body',
         
     | 
| 
      
 30 
     | 
    
         
            +
                  label: '内容区',
         
     | 
| 
      
 31 
     | 
    
         
            +
                  renderMethod: 'renderBody',
         
     | 
| 
      
 32 
     | 
    
         
            +
                  preferTag: '展示'
         
     | 
| 
      
 33 
     | 
    
         
            +
                },
         
     | 
| 
      
 34 
     | 
    
         
            +
                {
         
     | 
| 
      
 35 
     | 
    
         
            +
                  key: 'actions',
         
     | 
| 
      
 36 
     | 
    
         
            +
                  label: '按钮集合',
         
     | 
| 
      
 37 
     | 
    
         
            +
                  preferTag: '按钮',
         
     | 
| 
      
 38 
     | 
    
         
            +
                  renderMethod: 'renderRight',
         
     | 
| 
      
 39 
     | 
    
         
            +
                  insertPosition: 'inner'
         
     | 
| 
      
 40 
     | 
    
         
            +
                }
         
     | 
| 
      
 41 
     | 
    
         
            +
              ];
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              panelTitle = '列表项';
         
     | 
| 
      
 44 
     | 
    
         
            +
              panelBody = getSchemaTpl('tabs', [
         
     | 
| 
      
 45 
     | 
    
         
            +
                {
         
     | 
| 
      
 46 
     | 
    
         
            +
                  title: '基本',
         
     | 
| 
      
 47 
     | 
    
         
            +
                  body: [
         
     | 
| 
      
 48 
     | 
    
         
            +
                    // {
         
     | 
| 
      
 49 
     | 
    
         
            +
                    //   children: (
         
     | 
| 
      
 50 
     | 
    
         
            +
                    //     <Button
         
     | 
| 
      
 51 
     | 
    
         
            +
                    //       size="sm"
         
     | 
| 
      
 52 
     | 
    
         
            +
                    //       className="m-b-sm"
         
     | 
| 
      
 53 
     | 
    
         
            +
                    //       level="info"
         
     | 
| 
      
 54 
     | 
    
         
            +
                    //       block
         
     | 
| 
      
 55 
     | 
    
         
            +
                    //       onClick={() => {
         
     | 
| 
      
 56 
     | 
    
         
            +
                    //         this.pickChild('actions', 'actions', undefined, ['button']);
         
     | 
| 
      
 57 
     | 
    
         
            +
                    //       }}
         
     | 
| 
      
 58 
     | 
    
         
            +
                    //     >
         
     | 
| 
      
 59 
     | 
    
         
            +
                    //       新增按钮
         
     | 
| 
      
 60 
     | 
    
         
            +
                    //     </Button>
         
     | 
| 
      
 61 
     | 
    
         
            +
                    //   )
         
     | 
| 
      
 62 
     | 
    
         
            +
                    // },
         
     | 
| 
      
 63 
     | 
    
         
            +
                    // {
         
     | 
| 
      
 64 
     | 
    
         
            +
                    //   children: (
         
     | 
| 
      
 65 
     | 
    
         
            +
                    //     <div>
         
     | 
| 
      
 66 
     | 
    
         
            +
                    //       <Button
         
     | 
| 
      
 67 
     | 
    
         
            +
                    //         level="primary"
         
     | 
| 
      
 68 
     | 
    
         
            +
                    //         size="sm"
         
     | 
| 
      
 69 
     | 
    
         
            +
                    //         block
         
     | 
| 
      
 70 
     | 
    
         
            +
                    //         onClick={this.handleAdd}
         
     | 
| 
      
 71 
     | 
    
         
            +
                    //       >
         
     | 
| 
      
 72 
     | 
    
         
            +
                    //         新增内容
         
     | 
| 
      
 73 
     | 
    
         
            +
                    //       </Button>
         
     | 
| 
      
 74 
     | 
    
         
            +
                    //     </div>
         
     | 
| 
      
 75 
     | 
    
         
            +
                    //   )
         
     | 
| 
      
 76 
     | 
    
         
            +
                    // },
         
     | 
| 
      
 77 
     | 
    
         
            +
                    // {
         
     | 
| 
      
 78 
     | 
    
         
            +
                    //   type: 'divider'
         
     | 
| 
      
 79 
     | 
    
         
            +
                    // },
         
     | 
| 
      
 80 
     | 
    
         
            +
                    {
         
     | 
| 
      
 81 
     | 
    
         
            +
                      name: 'title',
         
     | 
| 
      
 82 
     | 
    
         
            +
                      type: 'input-text',
         
     | 
| 
      
 83 
     | 
    
         
            +
                      label: '标题',
         
     | 
| 
      
 84 
     | 
    
         
            +
                      descrition: '支持模板语法如: ${xxx}'
         
     | 
| 
      
 85 
     | 
    
         
            +
                    },
         
     | 
| 
      
 86 
     | 
    
         
            +
                    {
         
     | 
| 
      
 87 
     | 
    
         
            +
                      name: 'subTitle',
         
     | 
| 
      
 88 
     | 
    
         
            +
                      type: 'input-text',
         
     | 
| 
      
 89 
     | 
    
         
            +
                      label: '副标题',
         
     | 
| 
      
 90 
     | 
    
         
            +
                      descrition: '支持模板语法如: ${xxx}'
         
     | 
| 
      
 91 
     | 
    
         
            +
                    },
         
     | 
| 
      
 92 
     | 
    
         
            +
                    {
         
     | 
| 
      
 93 
     | 
    
         
            +
                      name: 'avatar',
         
     | 
| 
      
 94 
     | 
    
         
            +
                      type: 'input-text',
         
     | 
| 
      
 95 
     | 
    
         
            +
                      label: '图片地址',
         
     | 
| 
      
 96 
     | 
    
         
            +
                      descrition: '支持模板语法如: ${xxx}'
         
     | 
| 
      
 97 
     | 
    
         
            +
                    },
         
     | 
| 
      
 98 
     | 
    
         
            +
                    {
         
     | 
| 
      
 99 
     | 
    
         
            +
                      name: 'desc',
         
     | 
| 
      
 100 
     | 
    
         
            +
                      type: 'textarea',
         
     | 
| 
      
 101 
     | 
    
         
            +
                      label: '描述',
         
     | 
| 
      
 102 
     | 
    
         
            +
                      descrition: '支持模板语法如: ${xxx}'
         
     | 
| 
      
 103 
     | 
    
         
            +
                    }
         
     | 
| 
      
 104 
     | 
    
         
            +
                  ]
         
     | 
| 
      
 105 
     | 
    
         
            +
                },
         
     | 
| 
      
 106 
     | 
    
         
            +
                {
         
     | 
| 
      
 107 
     | 
    
         
            +
                  title: '外观',
         
     | 
| 
      
 108 
     | 
    
         
            +
                  body: [
         
     | 
| 
      
 109 
     | 
    
         
            +
                    getSchemaTpl('className', {
         
     | 
| 
      
 110 
     | 
    
         
            +
                      name: 'avatarClassName',
         
     | 
| 
      
 111 
     | 
    
         
            +
                      label: '图片 CSS 类名',
         
     | 
| 
      
 112 
     | 
    
         
            +
                      pipeIn: defaultValue('thumb-sm avatar m-r')
         
     | 
| 
      
 113 
     | 
    
         
            +
                    }),
         
     | 
| 
      
 114 
     | 
    
         
            +
                    getSchemaTpl('className', {
         
     | 
| 
      
 115 
     | 
    
         
            +
                      name: 'titleClassName',
         
     | 
| 
      
 116 
     | 
    
         
            +
                      label: '标题 CSS 类名'
         
     | 
| 
      
 117 
     | 
    
         
            +
                    })
         
     | 
| 
      
 118 
     | 
    
         
            +
                  ]
         
     | 
| 
      
 119 
     | 
    
         
            +
                }
         
     | 
| 
      
 120 
     | 
    
         
            +
              ]);
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
              getRendererInfo({
         
     | 
| 
      
 123 
     | 
    
         
            +
                renderer,
         
     | 
| 
      
 124 
     | 
    
         
            +
                schema
         
     | 
| 
      
 125 
     | 
    
         
            +
              }: RendererInfoResolveEventContext): BasicRendererInfo | void {
         
     | 
| 
      
 126 
     | 
    
         
            +
                if (schema.$$id && this.rendererName === renderer.name) {
         
     | 
| 
      
 127 
     | 
    
         
            +
                  // 复制部分信息出去
         
     | 
| 
      
 128 
     | 
    
         
            +
                  return {
         
     | 
| 
      
 129 
     | 
    
         
            +
                    name: this.panelTitle,
         
     | 
| 
      
 130 
     | 
    
         
            +
                    regions: this.regions,
         
     | 
| 
      
 131 
     | 
    
         
            +
                    // patchContainers: plugin.patchContainers,
         
     | 
| 
      
 132 
     | 
    
         
            +
                    // // wrapper: plugin.wrapper,
         
     | 
| 
      
 133 
     | 
    
         
            +
                    // vRendererConfig: plugin.vRendererConfig,
         
     | 
| 
      
 134 
     | 
    
         
            +
                    // wrapperProps: plugin.wrapperProps,
         
     | 
| 
      
 135 
     | 
    
         
            +
                    // wrapperResolve: plugin.wrapperResolve,
         
     | 
| 
      
 136 
     | 
    
         
            +
                    // filterProps: plugin.filterProps,
         
     | 
| 
      
 137 
     | 
    
         
            +
                    $schema: this.$schema
         
     | 
| 
      
 138 
     | 
    
         
            +
                    // renderRenderer: plugin.renderRenderer
         
     | 
| 
      
 139 
     | 
    
         
            +
                  };
         
     | 
| 
      
 140 
     | 
    
         
            +
                }
         
     | 
| 
      
 141 
     | 
    
         
            +
              }
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
              fieldWrapperResolve = (dom: HTMLElement) => dom;
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
              overrides = {
         
     | 
| 
      
 146 
     | 
    
         
            +
                renderFeild: function (
         
     | 
| 
      
 147 
     | 
    
         
            +
                  this: any,
         
     | 
| 
      
 148 
     | 
    
         
            +
                  region: string,
         
     | 
| 
      
 149 
     | 
    
         
            +
                  field: any,
         
     | 
| 
      
 150 
     | 
    
         
            +
                  index: any,
         
     | 
| 
      
 151 
     | 
    
         
            +
                  props: any
         
     | 
| 
      
 152 
     | 
    
         
            +
                ) {
         
     | 
| 
      
 153 
     | 
    
         
            +
                  const dom = this.super(region, field, index, props);
         
     | 
| 
      
 154 
     | 
    
         
            +
                  const info: RendererInfo = this.props.$$editor;
         
     | 
| 
      
 155 
     | 
    
         
            +
             
     | 
| 
      
 156 
     | 
    
         
            +
                  if (!info || !field.$$id) {
         
     | 
| 
      
 157 
     | 
    
         
            +
                    return dom;
         
     | 
| 
      
 158 
     | 
    
         
            +
                  }
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
                  const plugin = info.plugin as ListItemPlugin;
         
     | 
| 
      
 161 
     | 
    
         
            +
                  const id = field.$$id;
         
     | 
| 
      
 162 
     | 
    
         
            +
                  return (
         
     | 
| 
      
 163 
     | 
    
         
            +
                    <VRenderer
         
     | 
| 
      
 164 
     | 
    
         
            +
                      plugin={info.plugin}
         
     | 
| 
      
 165 
     | 
    
         
            +
                      renderer={info.renderer}
         
     | 
| 
      
 166 
     | 
    
         
            +
                      multifactor
         
     | 
| 
      
 167 
     | 
    
         
            +
                      key={id}
         
     | 
| 
      
 168 
     | 
    
         
            +
                      $schema="/schemas/ListBodyField.json"
         
     | 
| 
      
 169 
     | 
    
         
            +
                      hostId={info.id}
         
     | 
| 
      
 170 
     | 
    
         
            +
                      memberIndex={index}
         
     | 
| 
      
 171 
     | 
    
         
            +
                      name={`${`字段${index + 1}`}`}
         
     | 
| 
      
 172 
     | 
    
         
            +
                      id={id}
         
     | 
| 
      
 173 
     | 
    
         
            +
                      draggable={false}
         
     | 
| 
      
 174 
     | 
    
         
            +
                      wrapperResolve={plugin.fieldWrapperResolve}
         
     | 
| 
      
 175 
     | 
    
         
            +
                      schemaPath={`${info.schemaPath}/body/${index}`}
         
     | 
| 
      
 176 
     | 
    
         
            +
                      path={`${this.props.$path}/${index}`} // 好像没啥用
         
     | 
| 
      
 177 
     | 
    
         
            +
                      data={this.props.data} // 好像没啥用
         
     | 
| 
      
 178 
     | 
    
         
            +
                    >
         
     | 
| 
      
 179 
     | 
    
         
            +
                      {dom}
         
     | 
| 
      
 180 
     | 
    
         
            +
                    </VRenderer>
         
     | 
| 
      
 181 
     | 
    
         
            +
                  );
         
     | 
| 
      
 182 
     | 
    
         
            +
                }
         
     | 
| 
      
 183 
     | 
    
         
            +
              };
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
              vRendererConfig: VRendererConfig = {
         
     | 
| 
      
 186 
     | 
    
         
            +
                panelTitle: '字段',
         
     | 
| 
      
 187 
     | 
    
         
            +
                panelBodyCreator: (context: BaseEventContext) => {
         
     | 
| 
      
 188 
     | 
    
         
            +
                  return [
         
     | 
| 
      
 189 
     | 
    
         
            +
                    getSchemaTpl('label'),
         
     | 
| 
      
 190 
     | 
    
         
            +
                    getSchemaTpl('className', {
         
     | 
| 
      
 191 
     | 
    
         
            +
                      name: 'labelClassName',
         
     | 
| 
      
 192 
     | 
    
         
            +
                      label: 'Label CSS 类名',
         
     | 
| 
      
 193 
     | 
    
         
            +
                      visibleOn: 'this.label'
         
     | 
| 
      
 194 
     | 
    
         
            +
                    })
         
     | 
| 
      
 195 
     | 
    
         
            +
                    /*{
         
     | 
| 
      
 196 
     | 
    
         
            +
                      children: (
         
     | 
| 
      
 197 
     | 
    
         
            +
                        <Button
         
     | 
| 
      
 198 
     | 
    
         
            +
                          size="sm"
         
     | 
| 
      
 199 
     | 
    
         
            +
                          level="info"
         
     | 
| 
      
 200 
     | 
    
         
            +
                          className="m-b"
         
     | 
| 
      
 201 
     | 
    
         
            +
                          block
         
     | 
| 
      
 202 
     | 
    
         
            +
                          onClick={this.exchangeRenderer.bind(this, context.id)}
         
     | 
| 
      
 203 
     | 
    
         
            +
                        >
         
     | 
| 
      
 204 
     | 
    
         
            +
                          更改渲染器类型
         
     | 
| 
      
 205 
     | 
    
         
            +
                        </Button>
         
     | 
| 
      
 206 
     | 
    
         
            +
                      )
         
     | 
| 
      
 207 
     | 
    
         
            +
                    }*/
         
     | 
| 
      
 208 
     | 
    
         
            +
                  ];
         
     | 
| 
      
 209 
     | 
    
         
            +
                }
         
     | 
| 
      
 210 
     | 
    
         
            +
              };
         
     | 
| 
      
 211 
     | 
    
         
            +
             
     | 
| 
      
 212 
     | 
    
         
            +
              /*exchangeRenderer(id: string) {
         
     | 
| 
      
 213 
     | 
    
         
            +
                this.manager.showReplacePanel(id, '展示');
         
     | 
| 
      
 214 
     | 
    
         
            +
              }*/
         
     | 
| 
      
 215 
     | 
    
         
            +
             
     | 
| 
      
 216 
     | 
    
         
            +
              // 自动插入 label
         
     | 
| 
      
 217 
     | 
    
         
            +
              beforeInsert(event: PluginEvent<InsertEventContext>) {
         
     | 
| 
      
 218 
     | 
    
         
            +
                const context = event.context;
         
     | 
| 
      
 219 
     | 
    
         
            +
             
     | 
| 
      
 220 
     | 
    
         
            +
                if (
         
     | 
| 
      
 221 
     | 
    
         
            +
                  (context.info.plugin === this ||
         
     | 
| 
      
 222 
     | 
    
         
            +
                    context.node.sameIdChild?.info.plugin === this) &&
         
     | 
| 
      
 223 
     | 
    
         
            +
                  context.region === 'body'
         
     | 
| 
      
 224 
     | 
    
         
            +
                ) {
         
     | 
| 
      
 225 
     | 
    
         
            +
                  context.data = {
         
     | 
| 
      
 226 
     | 
    
         
            +
                    ...context.data,
         
     | 
| 
      
 227 
     | 
    
         
            +
                    label: context.data.label ?? context.subRenderer?.name ?? '列名称'
         
     | 
| 
      
 228 
     | 
    
         
            +
                  };
         
     | 
| 
      
 229 
     | 
    
         
            +
                }
         
     | 
| 
      
 230 
     | 
    
         
            +
              }
         
     | 
| 
      
 231 
     | 
    
         
            +
            }
         
     | 
| 
      
 232 
     | 
    
         
            +
             
     | 
| 
      
 233 
     | 
    
         
            +
            registerEditorPlugin(ListItemPlugin);
         
     | 
| 
         @@ -0,0 +1,52 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            /**
         
     | 
| 
      
 2 
     | 
    
         
            +
             * @file 日志组件
         
     | 
| 
      
 3 
     | 
    
         
            +
             */
         
     | 
| 
      
 4 
     | 
    
         
            +
            import {registerEditorPlugin} from '../manager';
         
     | 
| 
      
 5 
     | 
    
         
            +
            import {BaseEventContext, BasePlugin} from '../plugin';
         
     | 
| 
      
 6 
     | 
    
         
            +
            import {getSchemaTpl} from '../component/schemaTpl';
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            export class LogPlugin extends BasePlugin {
         
     | 
| 
      
 9 
     | 
    
         
            +
              // 关联渲染器名字
         
     | 
| 
      
 10 
     | 
    
         
            +
              rendererName = 'log';
         
     | 
| 
      
 11 
     | 
    
         
            +
              $schema = '/schemas/LogSchema.json';
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              // 组件名称
         
     | 
| 
      
 14 
     | 
    
         
            +
              name = '日志';
         
     | 
| 
      
 15 
     | 
    
         
            +
              isBaseComponent = true;
         
     | 
| 
      
 16 
     | 
    
         
            +
              icon = 'fa fa-file-text-o';
         
     | 
| 
      
 17 
     | 
    
         
            +
              description = '用来实时显示日志';
         
     | 
| 
      
 18 
     | 
    
         
            +
              docLink = '/amis/zh-CN/components/log';
         
     | 
| 
      
 19 
     | 
    
         
            +
              tags = ['展示'];
         
     | 
| 
      
 20 
     | 
    
         
            +
              previewSchema = {
         
     | 
| 
      
 21 
     | 
    
         
            +
                type: 'log',
         
     | 
| 
      
 22 
     | 
    
         
            +
                height: 120
         
     | 
| 
      
 23 
     | 
    
         
            +
              };
         
     | 
| 
      
 24 
     | 
    
         
            +
              scaffold: any = {
         
     | 
| 
      
 25 
     | 
    
         
            +
                type: 'log'
         
     | 
| 
      
 26 
     | 
    
         
            +
              };
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              panelTitle = '日志';
         
     | 
| 
      
 29 
     | 
    
         
            +
              panelBodyCreator = (context: BaseEventContext) => {
         
     | 
| 
      
 30 
     | 
    
         
            +
                return getSchemaTpl('tabs', [
         
     | 
| 
      
 31 
     | 
    
         
            +
                  {
         
     | 
| 
      
 32 
     | 
    
         
            +
                    title: '常规',
         
     | 
| 
      
 33 
     | 
    
         
            +
                    body: [
         
     | 
| 
      
 34 
     | 
    
         
            +
                      getSchemaTpl('api', {
         
     | 
| 
      
 35 
     | 
    
         
            +
                        label: '日志数据源',
         
     | 
| 
      
 36 
     | 
    
         
            +
                        name: 'source'
         
     | 
| 
      
 37 
     | 
    
         
            +
                      })
         
     | 
| 
      
 38 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 39 
     | 
    
         
            +
                  },
         
     | 
| 
      
 40 
     | 
    
         
            +
                  {
         
     | 
| 
      
 41 
     | 
    
         
            +
                    title: '外观',
         
     | 
| 
      
 42 
     | 
    
         
            +
                    body: [getSchemaTpl('className')]
         
     | 
| 
      
 43 
     | 
    
         
            +
                  },
         
     | 
| 
      
 44 
     | 
    
         
            +
                  {
         
     | 
| 
      
 45 
     | 
    
         
            +
                    title: '显隐',
         
     | 
| 
      
 46 
     | 
    
         
            +
                    body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
         
     | 
| 
      
 47 
     | 
    
         
            +
                  }
         
     | 
| 
      
 48 
     | 
    
         
            +
                ]);
         
     | 
| 
      
 49 
     | 
    
         
            +
              };
         
     | 
| 
      
 50 
     | 
    
         
            +
            }
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            registerEditorPlugin(LogPlugin);
         
     |