mindscreen/neos-prototype-generator

生成默认融合原型,以便映射到视图组件

0.3.2 2019-09-18 14:14 UTC

This package is auto-updated.

Last update: 2024-09-19 01:58:44 UTC


README

本包提供默认原型生成器,用于创建基于融合组件的原型,使前端开发者能够根据yaml配置和视图组件创建新的节点类型,而无需担心基本属性映射。

安装

composer require mindscreen/neos-prototype-generator

用法

  • Mindscreen.Neos:ContentComponent (或包含 'Mindscreen.Neos:PrototypeGeneratorMixin') 扩展您的新的节点类型。
  • 使用 type: stringui.inlineEditable: true 识别内联可编辑属性。可以使用 ui.inline.editorOptions.multiLine: true 启用块编辑。
  • 图像 (Neos\Media\Domain\Model\ImageInterface) 提供了 <property>Uri<property>Asset
  • 子节点将使用其特定节点作为上下文中的 node 进行渲染;Neos.Neos:ContentCollection 将使用相应的 nodePath 进行渲染
  • options.componentName 中设置特定的目标组件原型。
  • options.componentMapping.childNodes.<nodeName> 中指定子节点映射。

配置

设置

Mindscreen:
  Neos:
    PrototypeGenerator:
      componentPatterns:
        - '<package>:Component.Atom.<nodetype>'
        - '<package>:Component.Molecule.<nodetype>'
        - '<package>:Component.Organism.<nodetype>'
      superType: 'Neos.Neos:ContentComponent'

在节点类型中的用法

'Vendor.Package:Example':
  superTypes:
    'Neos.Neos:Content': true
    'Mindscreen.Neos:PrototypeGeneratorMixin': true
  childNodes:
    main:
      type: 'Neos.Neos:ContentCollection'
  properties:
    singleLine:
      type: string
      ui:
        inlineEditable: true
        inline:
          editorOptions:
            placeholder: singleline
    multiLine:
      type: string
      ui:
        inlineEditable: true
        inline:
          editorOptions:
            placeholder: multiline
            multiLine: true
  options:
    componentName: 'Vendor.Package:Components.General.Example'
    componentMapping:
      childNodes:
        main: content

注意

内容集合

如果一个节点类型是 Neos.Neos:ContentCollection(例如,生成一个简单的盒子组件),内容集合将作为 content 渲染。这可以通过选项 options.componentMapping.childNodes.this 进行配置。