amis-editor 4.2.0-beta.0 → 5.2.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/component/BaseControl.d.ts +1831 -0
- package/lib/component/BaseControl.js +366 -0
- package/{dist/component/base → lib/component}/InputComponentName.d.ts +0 -0
- package/lib/component/InputComponentName.js +44 -0
- package/{dist → lib}/component/TableViewEditor.d.ts +2 -2
- package/lib/component/TableViewEditor.js +528 -0
- package/lib/event-action/actions.d.ts +3 -0
- package/lib/event-action/actions.js +188 -0
- package/lib/event-action/schema.d.ts +13 -0
- package/lib/event-action/schema.js +134 -0
- package/{dist → lib}/index.d.ts +26 -33
- package/lib/index.js +181 -0
- package/{dist → lib}/plugin/Alert.d.ts +4 -2
- package/lib/plugin/Alert.js +113 -0
- package/lib/plugin/AnchorNav.d.ts +48 -0
- package/lib/plugin/AnchorNav.js +297 -0
- package/{dist → lib}/plugin/Audio.d.ts +1 -1
- package/lib/plugin/Audio.js +157 -0
- package/{dist → lib}/plugin/Avatar.d.ts +11 -2
- package/lib/plugin/Avatar.js +305 -0
- package/{dist → lib}/plugin/Breadcrumb.d.ts +1 -1
- package/lib/plugin/Breadcrumb.js +116 -0
- package/{dist → lib}/plugin/Button.d.ts +6 -2
- package/lib/plugin/Button.js +297 -0
- package/lib/plugin/ButtonGroup.d.ts +39 -0
- package/lib/plugin/ButtonGroup.js +139 -0
- package/{dist → lib}/plugin/ButtonToolbar.d.ts +5 -11
- package/lib/plugin/ButtonToolbar.js +89 -0
- package/{dist → lib}/plugin/CRUD.d.ts +3 -1
- package/lib/plugin/CRUD.js +1528 -0
- package/{dist → lib}/plugin/Card.d.ts +1 -1
- package/lib/plugin/Card.js +233 -0
- package/{dist → lib}/plugin/Cards.d.ts +1 -1
- package/lib/plugin/Cards.js +254 -0
- package/{dist → lib}/plugin/Carousel.d.ts +1 -1
- package/lib/plugin/Carousel.js +358 -0
- package/{dist → lib}/plugin/Chart.d.ts +3 -1
- package/lib/plugin/Chart.js +192 -0
- package/{dist → lib}/plugin/CodeView.d.ts +1 -1
- package/lib/plugin/CodeView.js +68 -0
- package/{dist → lib}/plugin/Collapse.d.ts +2 -1
- package/lib/plugin/Collapse.js +138 -0
- package/{dist → lib}/plugin/CollapseGroup.d.ts +29 -5
- package/lib/plugin/CollapseGroup.js +237 -0
- package/{dist → lib}/plugin/Container.d.ts +3 -2
- package/lib/plugin/Container.js +100 -0
- package/{dist → lib}/plugin/Custom.d.ts +1 -1
- package/lib/plugin/Custom.js +109 -0
- package/{dist → lib}/plugin/CustomRegion.d.ts +1 -1
- package/lib/plugin/CustomRegion.js +154 -0
- package/{dist → lib}/plugin/Date.d.ts +1 -1
- package/lib/plugin/Date.js +82 -0
- package/{dist → lib}/plugin/Datetime.d.ts +1 -1
- package/lib/plugin/Datetime.js +77 -0
- package/{dist → lib}/plugin/Dialog.d.ts +12 -2
- package/lib/plugin/Dialog.js +214 -0
- package/{dist → lib}/plugin/Divider.d.ts +1 -1
- package/lib/plugin/Divider.js +49 -0
- package/{dist → lib}/plugin/Drawer.d.ts +12 -2
- package/lib/plugin/Drawer.js +240 -0
- package/{dist → lib}/plugin/DropDownButton.d.ts +12 -11
- package/lib/plugin/DropDownButton.js +229 -0
- package/{dist → lib}/plugin/Each.d.ts +1 -1
- package/lib/plugin/Each.js +131 -0
- package/{dist → lib}/plugin/Flex.d.ts +1 -1
- package/lib/plugin/Flex.js +203 -0
- package/{dist → lib}/plugin/Form/ButtonGroupSelect.d.ts +7 -2
- package/lib/plugin/Form/ButtonGroupSelect.js +161 -0
- package/{dist → lib}/plugin/Form/ButtonToolbar.d.ts +8 -7
- package/lib/plugin/Form/ButtonToolbar.js +107 -0
- package/{dist → lib}/plugin/Form/ChainedSelect.d.ts +8 -2
- package/lib/plugin/Form/ChainedSelect.js +183 -0
- package/{dist → lib}/plugin/Form/Checkbox.d.ts +7 -2
- package/lib/plugin/Form/Checkbox.js +174 -0
- package/{dist → lib}/plugin/Form/Checkboxes.d.ts +8 -2
- package/lib/plugin/Form/Checkboxes.js +213 -0
- package/lib/plugin/Form/CodeEditor.d.ts +25 -0
- package/lib/plugin/Form/CodeEditor.js +201 -0
- package/{dist → lib}/plugin/Form/Combo.d.ts +4 -1
- package/lib/plugin/Form/Combo.js +546 -0
- package/{dist → lib}/plugin/Form/ConditionBuilder.d.ts +1 -1
- package/lib/plugin/Form/ConditionBuilder.js +302 -0
- package/{dist → lib}/plugin/Form/Control.d.ts +6 -2
- package/lib/plugin/Form/Control.js +88 -0
- package/{dist → lib}/plugin/Form/DiffEditor.d.ts +8 -2
- package/lib/plugin/Form/DiffEditor.js +204 -0
- package/{dist → lib}/plugin/Form/FieldSet.d.ts +1 -1
- package/lib/plugin/Form/FieldSet.js +152 -0
- package/{dist → lib}/plugin/Form/Form.d.ts +7 -1
- package/lib/plugin/Form/Form.js +846 -0
- package/{dist → lib}/plugin/Form/Formula.d.ts +2 -26
- package/lib/plugin/Form/Formula.js +82 -0
- package/{dist → lib}/plugin/Form/Group.d.ts +1 -1
- package/lib/plugin/Form/Group.js +252 -0
- package/{dist → lib}/plugin/Form/Hidden.d.ts +1 -1
- package/lib/plugin/Form/Hidden.js +58 -0
- package/{dist → lib}/plugin/Form/InputArray.d.ts +1 -1
- package/lib/plugin/Form/InputArray.js +181 -0
- package/{dist → lib}/plugin/Form/InputCity.d.ts +6 -2
- package/lib/plugin/Form/InputCity.js +139 -0
- package/{dist → lib}/plugin/Form/InputColor.d.ts +20 -18
- package/lib/plugin/Form/InputColor.js +295 -0
- package/lib/plugin/Form/InputDate.d.ts +26 -0
- package/lib/plugin/Form/InputDate.js +357 -0
- package/lib/plugin/Form/InputDateRange.d.ts +26 -0
- package/lib/plugin/Form/InputDateRange.js +350 -0
- package/{dist → lib}/plugin/Form/InputDateTime.d.ts +4 -4
- package/lib/plugin/Form/InputDateTime.js +50 -0
- package/lib/plugin/Form/InputDateTimeRange.d.ts +20 -0
- package/lib/plugin/Form/InputDateTimeRange.js +51 -0
- package/{dist → lib}/plugin/Form/InputEmail.d.ts +1 -0
- package/lib/plugin/Form/InputEmail.js +45 -0
- package/lib/plugin/Form/InputExcel.d.ts +23 -0
- package/lib/plugin/Form/InputExcel.js +121 -0
- package/{dist → lib}/plugin/Form/InputFile.d.ts +7 -3
- package/lib/plugin/Form/InputFile.js +354 -0
- package/{dist → lib}/plugin/Form/InputGroup.d.ts +1 -1
- package/lib/plugin/Form/InputGroup.js +100 -0
- package/{dist → lib}/plugin/Form/InputImage.d.ts +6 -2
- package/lib/plugin/Form/InputImage.js +271 -0
- package/{dist → lib}/plugin/Form/InputKV.d.ts +7 -1
- package/lib/plugin/Form/InputKV.js +129 -0
- package/{dist → lib}/plugin/Form/InputMonth.d.ts +1 -0
- package/lib/plugin/Form/InputMonth.js +48 -0
- package/{dist → lib}/plugin/Form/InputMonthRange.d.ts +4 -4
- package/lib/plugin/Form/InputMonthRange.js +51 -0
- package/{dist → lib}/plugin/Form/InputNumber.d.ts +7 -2
- package/lib/plugin/Form/InputNumber.js +263 -0
- package/{dist → lib}/plugin/Form/InputPassword.d.ts +1 -0
- package/lib/plugin/Form/InputPassword.js +45 -0
- package/{dist → lib}/plugin/Form/InputQuarter.d.ts +1 -0
- package/lib/plugin/Form/InputQuarter.js +48 -0
- package/{dist → lib}/plugin/Form/InputQuarterRange.d.ts +4 -4
- package/lib/plugin/Form/InputQuarterRange.js +51 -0
- package/{dist → lib}/plugin/Form/InputRange.d.ts +7 -2
- package/lib/plugin/Form/InputRange.js +292 -0
- package/lib/plugin/Form/InputRating.d.ts +25 -0
- package/lib/plugin/Form/InputRating.js +357 -0
- package/{dist → lib}/plugin/Form/InputRepeat.d.ts +1 -1
- package/lib/plugin/Form/InputRepeat.js +65 -0
- package/{dist → lib}/plugin/Form/InputRichText.d.ts +1 -1
- package/lib/plugin/Form/InputRichText.js +193 -0
- package/{dist → lib}/plugin/Form/InputSubForm.d.ts +1 -1
- package/lib/plugin/Form/InputSubForm.js +160 -0
- package/{dist → lib}/plugin/Form/InputTable.d.ts +1 -1
- package/lib/plugin/Form/InputTable.js +400 -0
- package/{dist → lib}/plugin/Form/InputTag.d.ts +6 -2
- package/lib/plugin/Form/InputTag.js +155 -0
- package/lib/plugin/Form/InputText.d.ts +42 -0
- package/lib/plugin/Form/InputText.js +328 -0
- package/{dist → lib}/plugin/Form/InputTime.d.ts +3 -3
- package/lib/plugin/Form/InputTime.js +48 -0
- package/{dist/plugin/Form/InputDateTimeRange.d.ts → lib/plugin/Form/InputTimeRange.d.ts} +4 -4
- package/lib/plugin/Form/InputTimeRange.js +51 -0
- package/{dist → lib}/plugin/Form/InputTree.d.ts +6 -2
- package/lib/plugin/Form/InputTree.js +375 -0
- package/{dist → lib}/plugin/Form/InputURL.d.ts +1 -0
- package/lib/plugin/Form/InputURL.js +46 -0
- package/{dist → lib}/plugin/Form/InputYear.d.ts +1 -0
- package/lib/plugin/Form/InputYear.js +48 -0
- package/{dist/plugin/Form/InputDate.d.ts → lib/plugin/Form/InputYearRange.d.ts} +4 -4
- package/lib/plugin/Form/InputYearRange.js +51 -0
- package/{dist → lib}/plugin/Form/Item.d.ts +2 -2
- package/lib/plugin/Form/Item.js +265 -0
- package/{dist → lib}/plugin/Form/ListSelect.d.ts +6 -2
- package/lib/plugin/Form/ListSelect.js +130 -0
- package/{dist/plugin/Form/InputDateRange.d.ts → lib/plugin/Form/LocationPicker.d.ts} +5 -6
- package/lib/plugin/Form/LocationPicker.js +74 -0
- package/{dist → lib}/plugin/Form/MatrixCheckboxes.d.ts +7 -2
- package/lib/plugin/Form/MatrixCheckboxes.js +234 -0
- package/{dist → lib}/plugin/Form/NestedSelect.d.ts +8 -2
- package/lib/plugin/Form/NestedSelect.js +328 -0
- package/{dist → lib}/plugin/Form/Picker.d.ts +1 -1
- package/lib/plugin/Form/Picker.js +169 -0
- package/{dist → lib}/plugin/Form/Radios.d.ts +7 -2
- package/lib/plugin/Form/Radios.js +189 -0
- package/{dist → lib}/plugin/Form/Select.d.ts +7 -2
- package/lib/plugin/Form/Select.js +304 -0
- package/{dist → lib}/plugin/Form/Static.d.ts +4 -3
- package/lib/plugin/Form/Static.js +312 -0
- package/{dist → lib}/plugin/Form/Switch.d.ts +7 -2
- package/lib/plugin/Form/Switch.js +219 -0
- package/{dist → lib}/plugin/Form/TabsTransfer.d.ts +5 -2
- package/lib/plugin/Form/TabsTransfer.js +348 -0
- package/{dist → lib}/plugin/Form/Textarea.d.ts +8 -2
- package/lib/plugin/Form/Textarea.js +190 -0
- package/{dist → lib}/plugin/Form/Transfer.d.ts +5 -2
- package/lib/plugin/Form/Transfer.js +414 -0
- package/{dist → lib}/plugin/Form/TreeSelect.d.ts +6 -2
- package/lib/plugin/Form/TreeSelect.js +375 -0
- package/{dist → lib}/plugin/Form/UUID.d.ts +1 -1
- package/lib/plugin/Form/UUID.js +55 -0
- package/{dist → lib}/plugin/Grid.d.ts +2 -2
- package/lib/plugin/Grid.js +680 -0
- package/{dist → lib}/plugin/HBox.d.ts +2 -2
- package/lib/plugin/HBox.js +594 -0
- package/{dist → lib}/plugin/IFrame.d.ts +3 -2
- package/lib/plugin/IFrame.js +94 -0
- package/{dist → lib}/plugin/Image.d.ts +1 -1
- package/lib/plugin/Image.js +264 -0
- package/{dist → lib}/plugin/Images.d.ts +1 -1
- package/lib/plugin/Images.js +214 -0
- package/{dist → lib}/plugin/Json.d.ts +1 -1
- package/lib/plugin/Json.js +82 -0
- package/{dist → lib}/plugin/Link.d.ts +2 -1
- package/lib/plugin/Link.js +120 -0
- package/{dist → lib}/plugin/List.d.ts +1 -1
- package/lib/plugin/List.js +220 -0
- package/{dist → lib}/plugin/ListItem.d.ts +1 -1
- package/lib/plugin/ListItem.js +195 -0
- package/{dist → lib}/plugin/Log.d.ts +1 -1
- package/lib/plugin/Log.js +62 -0
- package/{dist → lib}/plugin/Mapping.d.ts +1 -1
- package/lib/plugin/Mapping.js +149 -0
- package/{dist → lib}/plugin/Markdown.d.ts +1 -1
- package/lib/plugin/Markdown.js +58 -0
- package/lib/plugin/Nav.d.ts +48 -0
- package/lib/plugin/Nav.js +181 -0
- package/{dist → lib}/plugin/Operation.d.ts +1 -1
- package/lib/plugin/Operation.js +84 -0
- package/{dist → lib}/plugin/Others/Action.d.ts +6 -2
- package/lib/plugin/Others/Action.js +350 -0
- package/{dist → lib}/plugin/Others/TableCell.d.ts +1 -1
- package/lib/plugin/Others/TableCell.js +393 -0
- package/{dist → lib}/plugin/Page.d.ts +6 -3
- package/lib/plugin/Page.js +363 -0
- package/lib/plugin/Pagination.d.ts +51 -0
- package/lib/plugin/Pagination.js +247 -0
- package/{dist → lib}/plugin/Panel.d.ts +1 -1
- package/lib/plugin/Panel.js +222 -0
- package/{dist → lib}/plugin/Plain.d.ts +1 -1
- package/lib/plugin/Plain.js +88 -0
- package/{dist → lib}/plugin/Progress.d.ts +6 -2
- package/lib/plugin/Progress.js +258 -0
- package/{dist → lib}/plugin/Property.d.ts +1 -1
- package/lib/plugin/Property.js +147 -0
- package/{dist → lib}/plugin/QRCode.d.ts +1 -1
- package/lib/plugin/QRCode.js +107 -0
- package/{dist → lib}/plugin/Reset.d.ts +0 -0
- package/lib/plugin/Reset.js +38 -0
- package/{dist → lib}/plugin/Service.d.ts +4 -1
- package/lib/plugin/Service.js +217 -0
- package/{dist → lib}/plugin/Sparkline.d.ts +1 -1
- package/lib/plugin/Sparkline.js +50 -0
- package/{dist → lib}/plugin/Status.d.ts +1 -1
- package/lib/plugin/Status.js +86 -0
- package/{dist → lib}/plugin/Steps.d.ts +1 -1
- package/lib/plugin/Steps.js +136 -0
- package/{dist → lib}/plugin/Submit.d.ts +0 -0
- package/lib/plugin/Submit.js +38 -0
- package/{dist → lib}/plugin/Table.d.ts +6 -1
- package/lib/plugin/Table.js +594 -0
- package/{dist → lib}/plugin/TableView.d.ts +1 -1
- package/lib/plugin/TableView.js +744 -0
- package/{dist → lib}/plugin/Tabs.d.ts +33 -2
- package/lib/plugin/Tabs.js +429 -0
- package/{dist → lib}/plugin/Tasks.d.ts +1 -1
- package/lib/plugin/Tasks.js +263 -0
- package/{dist → lib}/plugin/Time.d.ts +1 -1
- package/lib/plugin/Time.js +77 -0
- package/{dist → lib}/plugin/TooltipWrapper.d.ts +11 -1
- package/lib/plugin/TooltipWrapper.js +281 -0
- package/{dist → lib}/plugin/Tpl.d.ts +3 -2
- package/lib/plugin/Tpl.js +183 -0
- package/{dist → lib}/plugin/Video.d.ts +1 -1
- package/lib/plugin/Video.js +140 -0
- package/{dist → lib}/plugin/WebComponent.d.ts +1 -1
- package/lib/plugin/WebComponent.js +70 -0
- package/{dist → lib}/plugin/Wizard.d.ts +5 -2
- package/lib/plugin/Wizard.js +799 -0
- package/{dist → lib}/plugin/Wrapper.d.ts +1 -1
- package/lib/plugin/Wrapper.js +136 -0
- package/lib/renderer/APIControl.d.ts +7526 -0
- package/lib/renderer/APIControl.js +791 -0
- package/lib/renderer/BadgeControl.d.ts +133 -0
- package/lib/renderer/BadgeControl.js +290 -0
- package/lib/renderer/DataBindingControl.d.ts +14 -0
- package/lib/renderer/DataBindingControl.js +91 -0
- package/lib/renderer/DataMappingControl.d.ts +11 -0
- package/lib/renderer/DataMappingControl.js +73 -0
- package/lib/renderer/DataPickerControl.d.ts +13 -0
- package/lib/renderer/DataPickerControl.js +83 -0
- package/lib/renderer/DateShortCutControl.d.ts +83 -0
- package/lib/renderer/DateShortCutControl.js +254 -0
- package/lib/renderer/FormulaControl.d.ts +96 -0
- package/lib/renderer/FormulaControl.js +324 -0
- package/{dist/component/Control → lib/renderer}/OptionControl.d.ts +23 -34
- package/lib/renderer/OptionControl.js +672 -0
- package/{dist/component/Control → lib/renderer}/PopoverEdit.d.ts +0 -0
- package/lib/renderer/RangePartsControl.d.ts +91 -0
- package/lib/renderer/RangePartsControl.js +392 -0
- package/lib/renderer/StatusControl.d.ts +39 -0
- package/lib/renderer/StatusControl.js +171 -0
- package/lib/renderer/SwitchMoreControl.d.ts +222 -0
- package/lib/renderer/SwitchMoreControl.js +302 -0
- package/lib/renderer/ValidationControl.d.ts +65 -0
- package/lib/renderer/ValidationControl.js +279 -0
- package/lib/renderer/ValidationItem.d.ts +46 -0
- package/lib/renderer/ValidationItem.js +147 -0
- package/lib/renderer/style-control/Background.d.ts +17 -0
- package/lib/renderer/style-control/Background.js +493 -0
- package/lib/renderer/style-control/Border.d.ts +18 -0
- package/lib/renderer/style-control/Border.js +191 -0
- package/lib/renderer/style-control/BoxModel.d.ts +17 -0
- package/lib/renderer/style-control/BoxModel.js +73 -0
- package/lib/renderer/style-control/BoxShadow.d.ts +18 -0
- package/lib/renderer/style-control/BoxShadow.js +125 -0
- package/lib/renderer/style-control/Display.d.ts +14 -0
- package/lib/renderer/style-control/Display.js +233 -0
- package/lib/renderer/style-control/Font.d.ts +16 -0
- package/lib/renderer/style-control/Font.js +239 -0
- package/lib/renderer/style-control/font-family.d.ts +11 -0
- package/lib/renderer/style-control/font-family.js +149 -0
- package/lib/renderer/style-control/transformation.d.ts +29 -0
- package/lib/renderer/style-control/transformation.js +84 -0
- package/lib/renderer/style-control/types.d.ts +8 -0
- package/lib/tpl/api.d.ts +1 -0
- package/lib/tpl/api.js +378 -0
- package/lib/tpl/common.d.ts +1 -0
- package/lib/tpl/common.js +808 -0
- package/lib/tpl/horizontal.d.ts +1 -0
- package/lib/tpl/horizontal.js +260 -0
- package/lib/tpl/index.d.ts +7 -0
- package/lib/tpl/options.d.ts +1 -0
- package/lib/tpl/options.js +265 -0
- package/{dist/component/schemaTpl.d.ts → lib/tpl/style.d.ts} +0 -4
- package/lib/tpl/style.js +372 -0
- package/lib/tpl/validations.d.ts +1 -0
- package/lib/tpl/validations.js +568 -0
- package/lib/util.d.ts +23 -0
- package/lib/util.js +64 -0
- package/lib/validator.d.ts +62 -0
- package/lib/validator.js +417 -0
- package/package.json +36 -32
- package/dist/cebfe0bc5a1dbde02da1.svg +0 -10
- package/dist/compat.d.ts +0 -30
- package/dist/component/Breadcrumb.d.ts +0 -33
- package/dist/component/ClassNameControl.d.ts +0 -31
- package/dist/component/CommonConfigWrapper.d.ts +0 -6
- package/dist/component/ContainerWrapper.d.ts +0 -12
- package/dist/component/Control/APIControl.d.ts +0 -504
- package/dist/component/Control/ValidationControl.d.ts +0 -30
- package/dist/component/Editor.d.ts +0 -81
- package/dist/component/HighlightBox.d.ts +0 -29
- package/dist/component/IFrameBridge.d.ts +0 -32
- package/dist/component/IFramePreview.d.ts +0 -38
- package/dist/component/MiniEditor.d.ts +0 -9
- package/dist/component/NodeWrapper.d.ts +0 -20
- package/dist/component/Panel/AMisCodeEditor.d.ts +0 -37
- package/dist/component/Panel/AvailableRenderersPanel.d.ts +0 -10
- package/dist/component/Panel/CodeEditorPanel.d.ts +0 -6
- package/dist/component/Panel/ContextMenuPanel.d.ts +0 -8
- package/dist/component/Panel/DrawerPanel.d.ts +0 -15
- package/dist/component/Panel/DrawerRendererPanel.d.ts +0 -15
- package/dist/component/Panel/InsertSubRendererPanel.d.ts +0 -11
- package/dist/component/Panel/LeftPanels.d.ts +0 -20
- package/dist/component/Panel/Outline.d.ts +0 -18
- package/dist/component/Panel/RenderersPanel.d.ts +0 -31
- package/dist/component/Panel/RightPanels.d.ts +0 -21
- package/dist/component/Panel/TargetNamePanel.d.ts +0 -7
- package/dist/component/PopOverForm.d.ts +0 -22
- package/dist/component/Preview.d.ts +0 -67
- package/dist/component/RegionHLBox.d.ts +0 -20
- package/dist/component/RegionWrapper.d.ts +0 -196
- package/dist/component/RendererThumb.d.ts +0 -22
- package/dist/component/ScaffoldModal.d.ts +0 -24
- package/dist/component/SubEditor.d.ts +0 -67
- package/dist/component/VRenderer.d.ts +0 -181
- package/dist/component/base/BackTop.d.ts +0 -26
- package/dist/component/base/ErrorRenderer.d.ts +0 -4
- package/dist/component/base/SearchCustomRendererPanel.d.ts +0 -15
- package/dist/component/base/SearchPanel.d.ts +0 -83
- package/dist/component/base/SearchRendererPanel.d.ts +0 -19
- package/dist/component/base/WidthDraggableBtn.d.ts +0 -16
- package/dist/component/base/WidthDraggableContainer.d.ts +0 -2
- package/dist/component/remarkTpl.d.ts +0 -150
- package/dist/dnd/default.d.ts +0 -47
- package/dist/dnd/index.d.ts +0 -119
- package/dist/dnd/interface.d.ts +0 -14
- package/dist/dnd/position-h.d.ts +0 -7
- package/dist/env.d.ts +0 -5
- package/dist/exports.d.ts +0 -8
- package/dist/exports.min.js +0 -1
- package/dist/icons/index.d.ts +0 -2
- package/dist/index.min.js +0 -1
- package/dist/manager.d.ts +0 -457
- package/dist/mocker.d.ts +0 -1
- package/dist/plugin/AnchorNav.d.ts +0 -67
- package/dist/plugin/ButtonGroup.d.ts +0 -60
- package/dist/plugin/ErrorRenderer.d.ts +0 -7
- package/dist/plugin/Form/CodeEditor.d.ts +0 -40
- package/dist/plugin/Form/InputExcel.d.ts +0 -58
- package/dist/plugin/Form/InputRating.d.ts +0 -19
- package/dist/plugin/Form/InputText.d.ts +0 -20
- package/dist/plugin/Form/LocationPicker.d.ts +0 -48
- package/dist/plugin/Nav.d.ts +0 -163
- package/dist/plugin/Others/BasicToolbar.d.ts +0 -11
- package/dist/plugin/Others/DataDebug.d.ts +0 -19
- package/dist/plugin/Others/Unknown.d.ts +0 -5
- package/dist/plugin/Panel/AvailableRenderers.d.ts +0 -8
- package/dist/plugin/Panel/Code.d.ts +0 -9
- package/dist/plugin/Panel/Name.d.ts +0 -8
- package/dist/plugin/Panel/Outline.d.ts +0 -8
- package/dist/plugin.d.ts +0 -601
- package/dist/store/editor.d.ts +0 -1021
- package/dist/store/node.d.ts +0 -265
- package/dist/style.css +0 -1
- package/dist/util.d.ts +0 -72
- package/src/component/schemaTpl.tsx +0 -2157
- package/src/plugin/Alert.tsx +0 -87
- package/src/plugin/AnchorNav.tsx +0 -233
- package/src/plugin/Audio.tsx +0 -154
- package/src/plugin/Avatar.tsx +0 -77
- package/src/plugin/Breadcrumb.tsx +0 -107
- package/src/plugin/Button.tsx +0 -281
- package/src/plugin/ButtonGroup.tsx +0 -85
- package/src/plugin/ButtonToolbar.tsx +0 -87
- package/src/plugin/CRUD.tsx +0 -1835
- package/src/plugin/Card.tsx +0 -290
- package/src/plugin/Cards.tsx +0 -318
- package/src/plugin/Carousel.tsx +0 -377
- package/src/plugin/Chart.tsx +0 -218
- package/src/plugin/CodeView.tsx +0 -60
- package/src/plugin/Collapse.tsx +0 -136
- package/src/plugin/CollapseGroup.tsx +0 -167
- package/src/plugin/Container.tsx +0 -40
- package/src/plugin/Custom.tsx +0 -128
- package/src/plugin/CustomRegion.tsx +0 -156
- package/src/plugin/Date.tsx +0 -74
- package/src/plugin/Datetime.tsx +0 -68
- package/src/plugin/Dialog.tsx +0 -176
- package/src/plugin/Divider.tsx +0 -36
- package/src/plugin/Drawer.tsx +0 -214
- package/src/plugin/DropDownButton.tsx +0 -235
- package/src/plugin/Each.tsx +0 -150
- package/src/plugin/ErrorRenderer.tsx +0 -15
- package/src/plugin/Flex.tsx +0 -151
- package/src/plugin/Form/ButtonGroupSelect.tsx +0 -75
- package/src/plugin/Form/ButtonToolbar.tsx +0 -110
- package/src/plugin/Form/ChainedSelect.tsx +0 -70
- package/src/plugin/Form/Checkbox.tsx +0 -87
- package/src/plugin/Form/Checkboxes.tsx +0 -167
- package/src/plugin/Form/CodeEditor.tsx +0 -81
- package/src/plugin/Form/Combo.tsx +0 -582
- package/src/plugin/Form/ConditionBuilder.tsx +0 -315
- package/src/plugin/Form/Control.tsx +0 -139
- package/src/plugin/Form/DiffEditor.tsx +0 -111
- package/src/plugin/Form/FieldSet.tsx +0 -163
- package/src/plugin/Form/Form.tsx +0 -687
- package/src/plugin/Form/Formula.tsx +0 -79
- package/src/plugin/Form/Group.tsx +0 -295
- package/src/plugin/Form/Hidden.tsx +0 -44
- package/src/plugin/Form/InputArray.tsx +0 -228
- package/src/plugin/Form/InputCity.tsx +0 -93
- package/src/plugin/Form/InputColor.tsx +0 -123
- package/src/plugin/Form/InputDate.tsx +0 -175
- package/src/plugin/Form/InputDateRange.tsx +0 -225
- package/src/plugin/Form/InputDateTime.tsx +0 -183
- package/src/plugin/Form/InputDateTimeRange.tsx +0 -221
- package/src/plugin/Form/InputEmail.tsx +0 -33
- package/src/plugin/Form/InputExcel.tsx +0 -85
- package/src/plugin/Form/InputFile.tsx +0 -221
- package/src/plugin/Form/InputGroup.tsx +0 -96
- package/src/plugin/Form/InputImage.tsx +0 -266
- package/src/plugin/Form/InputKV.tsx +0 -72
- package/src/plugin/Form/InputMonth.tsx +0 -35
- package/src/plugin/Form/InputMonthRange.tsx +0 -195
- package/src/plugin/Form/InputNumber.tsx +0 -89
- package/src/plugin/Form/InputPassword.tsx +0 -33
- package/src/plugin/Form/InputQuarter.tsx +0 -35
- package/src/plugin/Form/InputQuarterRange.tsx +0 -195
- package/src/plugin/Form/InputRange.tsx +0 -121
- package/src/plugin/Form/InputRating.tsx +0 -78
- package/src/plugin/Form/InputRepeat.tsx +0 -57
- package/src/plugin/Form/InputRichText.tsx +0 -186
- package/src/plugin/Form/InputSubForm.tsx +0 -189
- package/src/plugin/Form/InputTable.tsx +0 -434
- package/src/plugin/Form/InputTag.tsx +0 -70
- package/src/plugin/Form/InputText.tsx +0 -186
- package/src/plugin/Form/InputTime.tsx +0 -85
- package/src/plugin/Form/InputTree.tsx +0 -229
- package/src/plugin/Form/InputURL.tsx +0 -34
- package/src/plugin/Form/InputYear.tsx +0 -35
- package/src/plugin/Form/Item.tsx +0 -327
- package/src/plugin/Form/ListSelect.tsx +0 -73
- package/src/plugin/Form/LocationPicker.tsx +0 -62
- package/src/plugin/Form/MatrixCheckboxes.tsx +0 -136
- package/src/plugin/Form/NestedSelect.tsx +0 -211
- package/src/plugin/Form/Picker.tsx +0 -209
- package/src/plugin/Form/Radios.tsx +0 -119
- package/src/plugin/Form/Select.tsx +0 -233
- package/src/plugin/Form/Static.tsx +0 -322
- package/src/plugin/Form/Switch.tsx +0 -107
- package/src/plugin/Form/TabsTransfer.tsx +0 -259
- package/src/plugin/Form/Textarea.tsx +0 -83
- package/src/plugin/Form/Transfer.tsx +0 -368
- package/src/plugin/Form/TreeSelect.tsx +0 -263
- package/src/plugin/Form/UUID.tsx +0 -48
- package/src/plugin/Grid.tsx +0 -798
- package/src/plugin/HBox.tsx +0 -727
- package/src/plugin/IFrame.tsx +0 -70
- package/src/plugin/Image.tsx +0 -314
- package/src/plugin/Images.tsx +0 -231
- package/src/plugin/Json.tsx +0 -69
- package/src/plugin/Link.tsx +0 -93
- package/src/plugin/List.tsx +0 -278
- package/src/plugin/ListItem.tsx +0 -229
- package/src/plugin/Log.tsx +0 -52
- package/src/plugin/Mapping.tsx +0 -149
- package/src/plugin/Markdown.tsx +0 -47
- package/src/plugin/Nav.tsx +0 -184
- package/src/plugin/Operation.tsx +0 -95
- package/src/plugin/Others/Action.tsx +0 -426
- package/src/plugin/Others/BasicToolbar.tsx +0 -585
- package/src/plugin/Others/DataDebug.tsx +0 -134
- package/src/plugin/Others/TableCell.tsx +0 -480
- package/src/plugin/Others/Unknown.tsx +0 -37
- package/src/plugin/Page.tsx +0 -306
- package/src/plugin/Panel/AvailableRenderers.tsx +0 -41
- package/src/plugin/Panel/Code.tsx +0 -44
- package/src/plugin/Panel/Name.tsx +0 -26
- package/src/plugin/Panel/Outline.tsx +0 -40
- package/src/plugin/Panel.tsx +0 -243
- package/src/plugin/Plain.tsx +0 -84
- package/src/plugin/Progress.tsx +0 -125
- package/src/plugin/Property.tsx +0 -139
- package/src/plugin/QRCode.tsx +0 -96
- package/src/plugin/Reset.tsx +0 -23
- package/src/plugin/Service.tsx +0 -162
- package/src/plugin/Sparkline.tsx +0 -40
- package/src/plugin/Status.tsx +0 -76
- package/src/plugin/Steps.tsx +0 -128
- package/src/plugin/Submit.tsx +0 -23
- package/src/plugin/Table.tsx +0 -428
- package/src/plugin/TableView.tsx +0 -709
- package/src/plugin/Tabs.tsx +0 -362
- package/src/plugin/Tasks.tsx +0 -274
- package/src/plugin/Time.tsx +0 -68
- package/src/plugin/TooltipWrapper.tsx +0 -193
- package/src/plugin/Tpl.tsx +0 -158
- package/src/plugin/Video.tsx +0 -158
- package/src/plugin/WebComponent.tsx +0 -53
- package/src/plugin/Wizard.tsx +0 -740
- package/src/plugin/Wrapper.tsx +0 -107
- package/src/plugin.ts +0 -1050
- package/static/Code-hover.png +0 -0
- package/static/Code.png +0 -0
- package/static/Outline-hover.png +0 -0
- package/static/Outline.png +0 -0
- package/static/Renderers-hover.png +0 -0
- package/static/Renderers.png +0 -0
- package/static/side_hide_left.svg +0 -10
package/src/plugin.ts
DELETED
@@ -1,1050 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @file 定义插件的 interface,以及提供一个 BasePlugin 基类,把一些通用的方法放在这。
|
3
|
-
*/
|
4
|
-
|
5
|
-
import {RegionWrapperProps} from './component/RegionWrapper';
|
6
|
-
import {EditorManager} from './manager';
|
7
|
-
import {EditorStoreType} from './store/editor';
|
8
|
-
import {EditorNodeType} from './store/node';
|
9
|
-
import {DNDModeInterface} from './dnd/interface';
|
10
|
-
import {EditorDNDManager} from './dnd';
|
11
|
-
import React from 'react';
|
12
|
-
import {DiffChange} from './util';
|
13
|
-
import find from 'lodash/find';
|
14
|
-
import type {RendererConfig} from 'amis-core/lib/factory';
|
15
|
-
import type {MenuDivider, MenuItem} from 'amis-ui/lib/components/ContextMenu';
|
16
|
-
import type {BaseSchema} from 'amis/lib/Schema';
|
17
|
-
|
18
|
-
/**
|
19
|
-
* 区域的定义,容器渲染器都需要定义区域信息。
|
20
|
-
*/
|
21
|
-
export interface RegionConfig {
|
22
|
-
/**
|
23
|
-
* 简单情况,如果区域直接用的 render('region', subSchema)
|
24
|
-
* 这种只需要配置 key 就能简单插入 Region 节点。
|
25
|
-
*/
|
26
|
-
key: string;
|
27
|
-
|
28
|
-
/**
|
29
|
-
* 区域用来显示的名字。
|
30
|
-
*/
|
31
|
-
label: string;
|
32
|
-
|
33
|
-
/**
|
34
|
-
* 区域占位字符,用于提示
|
35
|
-
*/
|
36
|
-
placeholder?: string;
|
37
|
-
|
38
|
-
/**
|
39
|
-
* 对于复杂的控件需要用到这个配置。
|
40
|
-
* 如果配置了,则遍历 react dom 直到目标节点调换成 Region 节点
|
41
|
-
*
|
42
|
-
* 如果没有配置这个,但是又配置了 renderMethod 方法,
|
43
|
-
* 那就直接将 renderMethod 里面返回的 react dom 直接包一层 Region
|
44
|
-
*/
|
45
|
-
matchRegion?: (
|
46
|
-
elem: JSX.Element | undefined | null,
|
47
|
-
component: JSX.Element
|
48
|
-
) => boolean;
|
49
|
-
|
50
|
-
/**
|
51
|
-
* 指定要覆盖哪个方法。
|
52
|
-
*/
|
53
|
-
renderMethod?: string;
|
54
|
-
|
55
|
-
/**
|
56
|
-
* 通常是hack 当前渲染器,单有时候当前渲染器其实是组合的别的渲染器。
|
57
|
-
*/
|
58
|
-
rendererName?: string;
|
59
|
-
|
60
|
-
/**
|
61
|
-
* 当配置 renderMethod 的时候会自动把 Region 插入进去。
|
62
|
-
* 默认是 outter 模式,有时候可能需要配置成 inner,
|
63
|
-
* 比如 renderMethod 为 render 的时候。
|
64
|
-
*/
|
65
|
-
insertPosition?: 'outter' | 'inner';
|
66
|
-
|
67
|
-
/**
|
68
|
-
* 是否为可选容器,如果是可选容器,不会强制自动创建成员
|
69
|
-
*/
|
70
|
-
optional?: boolean;
|
71
|
-
|
72
|
-
/**
|
73
|
-
* 有时候有些包括是需要其他条件的,所以要自己写包裹逻辑。
|
74
|
-
* 比如 Panel 里面的 renderBody
|
75
|
-
*/
|
76
|
-
renderMethodOverride?: (
|
77
|
-
regions: Array<RegionConfig>,
|
78
|
-
insertRegion: (
|
79
|
-
component: JSX.Element,
|
80
|
-
dom: JSX.Element,
|
81
|
-
regions: Array<RegionConfig>,
|
82
|
-
info: RendererInfo,
|
83
|
-
manager: EditorManager
|
84
|
-
) => JSX.Element
|
85
|
-
) => Function;
|
86
|
-
|
87
|
-
/**
|
88
|
-
* 偏好什么类型的组件?比如表单里面,controls 容器偏向表单项。
|
89
|
-
*/
|
90
|
-
preferTag?: string;
|
91
|
-
|
92
|
-
/**
|
93
|
-
* 用来指定用什么组件包裹,默认是 RegionWrapper
|
94
|
-
*/
|
95
|
-
wrapper?: React.ComponentType<RegionWrapperProps>;
|
96
|
-
|
97
|
-
/**
|
98
|
-
* 返回需要添加 data-region 的 dom 节点。
|
99
|
-
*/
|
100
|
-
wrapperResolve?: (dom: HTMLElement) => HTMLElement;
|
101
|
-
|
102
|
-
/**
|
103
|
-
* 当拖入到这个容器时,是否需要修改一下 ghost 结构?
|
104
|
-
*/
|
105
|
-
modifyGhost?: (ghost: HTMLElement, schema?: any) => void;
|
106
|
-
|
107
|
-
/**
|
108
|
-
* dnd 拖拽模式。比如 table 那种需要配置成 position-h
|
109
|
-
*/
|
110
|
-
dndMode?:
|
111
|
-
| 'default'
|
112
|
-
| 'position-h'
|
113
|
-
| 'position-v'
|
114
|
-
| (new (dnd: EditorDNDManager) => DNDModeInterface);
|
115
|
-
|
116
|
-
/**
|
117
|
-
* 可以用来判断是否允许拖入当前节点。
|
118
|
-
*/
|
119
|
-
accept?: (json: any) => boolean;
|
120
|
-
}
|
121
|
-
|
122
|
-
export interface VRendererConfig {
|
123
|
-
/**
|
124
|
-
* 配置了这些会自动创建编辑面板。
|
125
|
-
*/
|
126
|
-
panelIcon?: string;
|
127
|
-
panelTitle?: string;
|
128
|
-
/**
|
129
|
-
* @deprecated 用 panelBody 代替
|
130
|
-
*/
|
131
|
-
panelControls?: Array<any>;
|
132
|
-
panelDefinitions?: any;
|
133
|
-
/**
|
134
|
-
* @deprecated 用panelBodyCreator 代替
|
135
|
-
*/
|
136
|
-
panelControlsCreator?: (context: BaseEventContext) => Array<any>;
|
137
|
-
panelBody?: Array<any>;
|
138
|
-
panelBodyCreator?: (context: BaseEventContext) => Array<any>;
|
139
|
-
|
140
|
-
/**
|
141
|
-
* 配置了,要是不在 overides 里面使用也是没用的。
|
142
|
-
*/
|
143
|
-
regions?: {
|
144
|
-
[propName: string]: RegionConfig;
|
145
|
-
};
|
146
|
-
}
|
147
|
-
|
148
|
-
export interface RendererScaffoldInfo {
|
149
|
-
/**
|
150
|
-
* 组件名称
|
151
|
-
*/
|
152
|
-
name: string;
|
153
|
-
|
154
|
-
// 图标
|
155
|
-
icon?: string;
|
156
|
-
|
157
|
-
// 组件描述信息
|
158
|
-
description?: string;
|
159
|
-
|
160
|
-
// 文档链接
|
161
|
-
docLink?: string;
|
162
|
-
|
163
|
-
// 用来生成预览图
|
164
|
-
previewSchema?: any;
|
165
|
-
|
166
|
-
// 分类
|
167
|
-
tags?: string | Array<string>;
|
168
|
-
|
169
|
-
// type 和 scaffold 二选一
|
170
|
-
type?: string;
|
171
|
-
scaffold?: any;
|
172
|
-
}
|
173
|
-
|
174
|
-
/**
|
175
|
-
* 渲染器信息。
|
176
|
-
*/
|
177
|
-
export interface RendererInfo extends RendererScaffoldInfo {
|
178
|
-
scaffolds?: Array<Partial<RendererScaffoldInfo>>;
|
179
|
-
|
180
|
-
rendererName?: string;
|
181
|
-
|
182
|
-
/**
|
183
|
-
* json schema 协议
|
184
|
-
*/
|
185
|
-
$schema?: string;
|
186
|
-
|
187
|
-
isBaseComponent?: boolean;
|
188
|
-
|
189
|
-
disabledRendererPlugin?: boolean;
|
190
|
-
|
191
|
-
/**
|
192
|
-
* 配置区域。
|
193
|
-
*/
|
194
|
-
regions?: Array<RegionConfig>;
|
195
|
-
|
196
|
-
/**
|
197
|
-
* 哪些容器属性需要自动转成数组的。如果不配置默认就从 regions 里面读取。
|
198
|
-
*/
|
199
|
-
patchContainers?: Array<string>;
|
200
|
-
|
201
|
-
/**
|
202
|
-
* 覆盖的目标渲染器名称
|
203
|
-
*/
|
204
|
-
overrideTargetRendererName?: string;
|
205
|
-
|
206
|
-
/**
|
207
|
-
* 覆写某些方法,一般用来插入虚拟的渲染器编辑器。
|
208
|
-
*/
|
209
|
-
overrides?: {
|
210
|
-
[propName: string]: Function;
|
211
|
-
};
|
212
|
-
|
213
|
-
/**
|
214
|
-
* 虚拟渲染器的配置项,有时候需要给那些并不是渲染器的组件添加点选编辑功能。
|
215
|
-
* 比如: Tabs 下面的 Tab, 这个并不是个渲染器,但是需要可以点选修改内容。
|
216
|
-
*/
|
217
|
-
vRendererConfig?: VRendererConfig;
|
218
|
-
|
219
|
-
/**
|
220
|
-
* 默认为 BaseWrapper, 容器类的指定为 BaseContainerWrapper 或者再实现一个
|
221
|
-
* 暂时没有需要配置的所以注释掉。
|
222
|
-
* wrapper?: React.ComponentType<NodeWrapperProps>;
|
223
|
-
*
|
224
|
-
* 返回哪些 dom 节点,需要自动加上 data-editor-id 属性
|
225
|
-
* 目前只有 TableCell 里面用到了,就它需要同时给某一列下所有 td 都加上那个属性。
|
226
|
-
*/
|
227
|
-
wrapperResolve?: (dom: HTMLElement) => HTMLElement | Array<HTMLElement>;
|
228
|
-
|
229
|
-
/**
|
230
|
-
* 默认下发哪些属性,如果要动态下发,请使用 filterProps
|
231
|
-
*/
|
232
|
-
wrapperProps?: any;
|
233
|
-
|
234
|
-
/**
|
235
|
-
* 修改一些属性,一般用来干掉 $$id
|
236
|
-
* 这样它的孩子节点就不能直接点选编辑了,比如 Combo。
|
237
|
-
*/
|
238
|
-
filterProps?: (props: any, node: EditorNodeType) => any;
|
239
|
-
|
240
|
-
/**
|
241
|
-
* 有些没有视图的组件,可以自己输出点内容,否则没办法点选编辑。
|
242
|
-
*/
|
243
|
-
renderRenderer?: (props: any, info: RendererInfo) => JSX.Element;
|
244
|
-
|
245
|
-
/**
|
246
|
-
* 是否有多重身份?
|
247
|
-
* 比如 CRUD 即是 CRUD 又可能是 Table
|
248
|
-
*
|
249
|
-
* 表格的列,即是表格列,也可能是其他文本框。
|
250
|
-
*
|
251
|
-
* 配置了这个后会自动添加多个 Panel 面板来编辑。
|
252
|
-
*/
|
253
|
-
multifactor?: boolean;
|
254
|
-
|
255
|
-
/**
|
256
|
-
* 右键的时候是否出现重新构建,靠这个。
|
257
|
-
*/
|
258
|
-
scaffoldForm?: ScaffoldForm;
|
259
|
-
|
260
|
-
// 自动填入,不用配置
|
261
|
-
id: string;
|
262
|
-
plugin: PluginInterface;
|
263
|
-
extraPlugin?: PluginInterface; // 辅助插件,看需求。
|
264
|
-
renderer: RendererConfig;
|
265
|
-
schemaPath: string;
|
266
|
-
|
267
|
-
// 给 subEditor 用的,别直接配置
|
268
|
-
editable?: boolean; // 是否可编辑。
|
269
|
-
removable?: boolean; // 是否可被删除
|
270
|
-
draggable?: boolean; // 是否可被拖动
|
271
|
-
movable?: boolean; // 是否可被移动
|
272
|
-
replaceable?: boolean; // 是否可被替换
|
273
|
-
duplicatable?: boolean; // 是否可以重复一份
|
274
|
-
memberImmutable?: boolean | Array<string>; // 成员节点固定,意味着不能新增成员
|
275
|
-
typeMutable?: boolean; // 类型是否可被修改
|
276
|
-
|
277
|
-
// 如果是虚拟的渲染器
|
278
|
-
hostId?: string;
|
279
|
-
memberIndex?: number;
|
280
|
-
}
|
281
|
-
|
282
|
-
export type BasicRendererInfo = Omit<
|
283
|
-
RendererInfo,
|
284
|
-
'id' | 'plugin' | 'renderer' | 'schemaPath'
|
285
|
-
>;
|
286
|
-
|
287
|
-
export interface PopOverForm {
|
288
|
-
title?: string;
|
289
|
-
|
290
|
-
/**
|
291
|
-
* 脚手架配置项。
|
292
|
-
*/
|
293
|
-
body: Array<any>;
|
294
|
-
|
295
|
-
/**
|
296
|
-
* @deprecated 改用 body 代替
|
297
|
-
*/
|
298
|
-
controls?: Array<any>;
|
299
|
-
}
|
300
|
-
|
301
|
-
export interface ScaffoldForm extends PopOverForm {
|
302
|
-
mode?: 'normal' | 'horizontal' | 'inline';
|
303
|
-
|
304
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
305
|
-
initApi?: any;
|
306
|
-
api?: any;
|
307
|
-
|
308
|
-
/**
|
309
|
-
* 整体验证脚手架配置,如果有错误返回错误对象。
|
310
|
-
* key 是配置的字段名。
|
311
|
-
* value 是具体错误信息。
|
312
|
-
*/
|
313
|
-
validate?: (
|
314
|
-
values: any
|
315
|
-
) =>
|
316
|
-
| void
|
317
|
-
| {[propName: string]: string}
|
318
|
-
| Promise<void | {[propName: string]: string}>;
|
319
|
-
|
320
|
-
/**
|
321
|
-
* schema 配置转脚手架配置
|
322
|
-
*/
|
323
|
-
pipeIn?: (value: any) => any;
|
324
|
-
|
325
|
-
/**
|
326
|
-
* 脚手架配置转 schema 配置。
|
327
|
-
*/
|
328
|
-
pipeOut?: (value: any) => any;
|
329
|
-
|
330
|
-
/**
|
331
|
-
* 是否允许重新构建;
|
332
|
-
*/
|
333
|
-
canRebuild?: boolean;
|
334
|
-
}
|
335
|
-
|
336
|
-
/**
|
337
|
-
* 子渲染器信息
|
338
|
-
*/
|
339
|
-
export interface SubRendererInfo extends RendererScaffoldInfo {
|
340
|
-
/**
|
341
|
-
* 用于判断是否是平台预置组件,平台预置组件为true。
|
342
|
-
*/
|
343
|
-
isBaseComponent?: boolean;
|
344
|
-
|
345
|
-
rendererName?: string;
|
346
|
-
/**
|
347
|
-
* 首次拖入的时候可以用来配置个表单。
|
348
|
-
*/
|
349
|
-
scaffoldForm?: ScaffoldForm;
|
350
|
-
/**
|
351
|
-
* 新增属性,用于判断是否出现在组件面板中,默认为false,为ture则不展示
|
352
|
-
*/
|
353
|
-
disabledRendererPlugin?: boolean;
|
354
|
-
|
355
|
-
// 自动填入,不用配置
|
356
|
-
plugin: PluginInterface;
|
357
|
-
parent: RendererInfo;
|
358
|
-
id: string;
|
359
|
-
order: number;
|
360
|
-
}
|
361
|
-
|
362
|
-
export type BasicSubRenderInfo = Omit<
|
363
|
-
SubRendererInfo,
|
364
|
-
'plugin' | 'parent' | 'id' | 'order'
|
365
|
-
> &
|
366
|
-
Partial<Pick<SubRendererInfo, 'order'>>;
|
367
|
-
|
368
|
-
/**
|
369
|
-
* 工具按钮信息。
|
370
|
-
*/
|
371
|
-
export interface ToolbarItem {
|
372
|
-
label?: string;
|
373
|
-
id?: string;
|
374
|
-
order: number;
|
375
|
-
level?: 'primary' | 'secondary' | 'special';
|
376
|
-
className?: string;
|
377
|
-
draggable?: boolean;
|
378
|
-
onDragStart?: (e: any) => void;
|
379
|
-
icon?: string;
|
380
|
-
iconSvg?: string; // 自定义icon(svg格式)
|
381
|
-
onClick?: (e: any) => void;
|
382
|
-
tooltip?: string;
|
383
|
-
placement?: 'top' | 'bottom' | 'right' | 'left';
|
384
|
-
}
|
385
|
-
|
386
|
-
export type BasicToolbarItem = Partial<ToolbarItem>;
|
387
|
-
|
388
|
-
export type ContextMenuItem = MenuItem | MenuDivider;
|
389
|
-
|
390
|
-
/**
|
391
|
-
* 面板的属性定义
|
392
|
-
*/
|
393
|
-
export interface PanelProps {
|
394
|
-
id?: string;
|
395
|
-
info?: RendererInfo;
|
396
|
-
path?: string;
|
397
|
-
node?: EditorNodeType;
|
398
|
-
value: BaseSchema;
|
399
|
-
onChange: (value: BaseSchema, diff?: Array<DiffChange>) => void;
|
400
|
-
store: EditorStoreType;
|
401
|
-
manager: EditorManager;
|
402
|
-
popOverContainer?: () => HTMLElement | void;
|
403
|
-
}
|
404
|
-
|
405
|
-
/**
|
406
|
-
* 面板信息定义
|
407
|
-
*/
|
408
|
-
export interface PanelItem {
|
409
|
-
nodeId?: string;
|
410
|
-
key: string;
|
411
|
-
icon: string;
|
412
|
-
title: string | JSX.Element; // 标题
|
413
|
-
component?: React.ComponentType<PanelProps | any>;
|
414
|
-
order: number;
|
415
|
-
position?: 'left' | 'right';
|
416
|
-
render?: (props: PanelProps) => JSX.Element;
|
417
|
-
menus?: Array<any>;
|
418
|
-
}
|
419
|
-
|
420
|
-
export type BasicPanelItem = Omit<PanelItem, 'order'> &
|
421
|
-
Partial<Pick<PanelItem, 'order'>>;
|
422
|
-
|
423
|
-
export interface EventContext {
|
424
|
-
data?: any;
|
425
|
-
[propName: string]: any;
|
426
|
-
}
|
427
|
-
|
428
|
-
/**
|
429
|
-
* 事件上下文
|
430
|
-
*/
|
431
|
-
export interface BaseEventContext extends EventContext {
|
432
|
-
node: EditorNodeType;
|
433
|
-
id: string;
|
434
|
-
info: RendererInfo;
|
435
|
-
path: string;
|
436
|
-
schema: any;
|
437
|
-
schemaPath: string;
|
438
|
-
secondFactor?: boolean;
|
439
|
-
}
|
440
|
-
|
441
|
-
export interface RendererInfoResolveEventContext extends EventContext {
|
442
|
-
renderer: RendererConfig;
|
443
|
-
path: string;
|
444
|
-
schema: any;
|
445
|
-
schemaPath: string;
|
446
|
-
data?: RendererInfo;
|
447
|
-
}
|
448
|
-
|
449
|
-
export interface RendererJSONSchemaResolveEventContext
|
450
|
-
extends BaseEventContext {
|
451
|
-
data: string;
|
452
|
-
}
|
453
|
-
|
454
|
-
/**
|
455
|
-
* 右键菜单事件的上下文。
|
456
|
-
*/
|
457
|
-
export interface ContextMenuEventContext extends BaseEventContext {
|
458
|
-
region: string;
|
459
|
-
selections: Array<BaseEventContext>;
|
460
|
-
data: Array<ContextMenuItem>;
|
461
|
-
}
|
462
|
-
|
463
|
-
export interface SelectionEventContext extends BaseEventContext {
|
464
|
-
selections: Array<BaseEventContext>;
|
465
|
-
data: Array<string>;
|
466
|
-
}
|
467
|
-
|
468
|
-
export interface RendererEventContext extends BaseEventContext {
|
469
|
-
region?: string;
|
470
|
-
}
|
471
|
-
|
472
|
-
export interface ActiveEventContext extends Partial<BaseEventContext> {
|
473
|
-
active?: boolean;
|
474
|
-
}
|
475
|
-
|
476
|
-
export interface DeleteEventContext extends BaseEventContext {
|
477
|
-
data?: Array<string>;
|
478
|
-
}
|
479
|
-
|
480
|
-
/**
|
481
|
-
* 插入节点的事件上下文信息
|
482
|
-
*/
|
483
|
-
export interface InsertEventContext extends BaseEventContext {
|
484
|
-
region: string;
|
485
|
-
beforeId?: string;
|
486
|
-
index: number;
|
487
|
-
data: any;
|
488
|
-
subRenderer?: SubRendererInfo;
|
489
|
-
dragInfo?: {
|
490
|
-
id: string;
|
491
|
-
type: string;
|
492
|
-
data: any;
|
493
|
-
};
|
494
|
-
}
|
495
|
-
|
496
|
-
export interface ReplaceEventContext extends BaseEventContext {
|
497
|
-
data: any;
|
498
|
-
subRenderer?: SubRendererInfo;
|
499
|
-
region?: string;
|
500
|
-
}
|
501
|
-
|
502
|
-
export interface MoveEventContext extends BaseEventContext {
|
503
|
-
region: string;
|
504
|
-
sourceId: string;
|
505
|
-
beforeId?: string;
|
506
|
-
direction?: 'up' | 'down';
|
507
|
-
}
|
508
|
-
|
509
|
-
/**
|
510
|
-
* 更新节点的事件上下文
|
511
|
-
*/
|
512
|
-
export interface ChangeEventContext extends BaseEventContext {
|
513
|
-
value: any;
|
514
|
-
readonly diff: Array<DiffChange>;
|
515
|
-
}
|
516
|
-
|
517
|
-
export interface DragEventContext extends EventContext {
|
518
|
-
mode: 'move' | 'copy';
|
519
|
-
sourceType: 'schema' | 'subrenderer' | string;
|
520
|
-
sourceId: string;
|
521
|
-
data: any;
|
522
|
-
|
523
|
-
targetId?: string;
|
524
|
-
targetRegion?: string;
|
525
|
-
}
|
526
|
-
|
527
|
-
export interface BuildPanelEventContext extends BaseEventContext {
|
528
|
-
data: Array<BasicPanelItem>;
|
529
|
-
selections: Array<BaseEventContext>;
|
530
|
-
}
|
531
|
-
|
532
|
-
export interface PreventClickEventContext extends EventContext {
|
533
|
-
data: MouseEvent;
|
534
|
-
}
|
535
|
-
|
536
|
-
export interface ResizeMoveEventContext extends EventContext {
|
537
|
-
data: Object;
|
538
|
-
nativeEvent: MouseEvent;
|
539
|
-
dom: HTMLElement;
|
540
|
-
resizer: HTMLElement;
|
541
|
-
node: EditorNodeType;
|
542
|
-
}
|
543
|
-
|
544
|
-
/**
|
545
|
-
* 将事件上下文转成事件对象。
|
546
|
-
*/
|
547
|
-
export type PluginEvent<T, P = any> = {
|
548
|
-
context: T;
|
549
|
-
type: string;
|
550
|
-
preventDefault: () => void;
|
551
|
-
stopPropagation: () => void;
|
552
|
-
setData: (data: P) => void;
|
553
|
-
|
554
|
-
// 是否被阻止?
|
555
|
-
prevented?: boolean;
|
556
|
-
stoped?: boolean;
|
557
|
-
|
558
|
-
// 当前值
|
559
|
-
data?: P;
|
560
|
-
};
|
561
|
-
|
562
|
-
export type PluginEventFn = (e: PluginEvent<EventContext>) => false | void;
|
563
|
-
|
564
|
-
/**
|
565
|
-
* 创建事件。
|
566
|
-
* @param type
|
567
|
-
* @param context
|
568
|
-
*/
|
569
|
-
export function createEvent<T extends EventContext>(
|
570
|
-
type: string,
|
571
|
-
context: T
|
572
|
-
): PluginEvent<T> {
|
573
|
-
const event = {
|
574
|
-
context,
|
575
|
-
type,
|
576
|
-
prevented: false,
|
577
|
-
stoped: false,
|
578
|
-
preventDefault() {
|
579
|
-
event.prevented = true;
|
580
|
-
},
|
581
|
-
stopPropagation() {
|
582
|
-
event.stoped = true;
|
583
|
-
},
|
584
|
-
get data() {
|
585
|
-
return event.context.data;
|
586
|
-
},
|
587
|
-
setData(data: any) {
|
588
|
-
event.context.data = data;
|
589
|
-
}
|
590
|
-
};
|
591
|
-
|
592
|
-
return event;
|
593
|
-
}
|
594
|
-
|
595
|
-
export interface PluginEventListener {
|
596
|
-
onActive?: (event: PluginEvent<ActiveEventContext>) => void;
|
597
|
-
|
598
|
-
/**
|
599
|
-
* 事件,当有配置项插入前调用。通过 event.preventDefault() 可以干预。
|
600
|
-
*/
|
601
|
-
beforeInsert?: (event: PluginEvent<InsertEventContext>) => false | void;
|
602
|
-
afterInsert?: (event: PluginEvent<InsertEventContext>) => void;
|
603
|
-
|
604
|
-
/**
|
605
|
-
* 面板里面编辑修改的事件。
|
606
|
-
*/
|
607
|
-
beforeUpdate?: (event: PluginEvent<ChangeEventContext>) => false | void;
|
608
|
-
afterUpdate?: (event: PluginEvent<ChangeEventContext>) => void;
|
609
|
-
|
610
|
-
/**
|
611
|
-
* 更新渲染器,或者右键粘贴配置。
|
612
|
-
*/
|
613
|
-
beforeReplace?: (event: PluginEvent<ReplaceEventContext>) => false | void;
|
614
|
-
afterReplace?: (event: PluginEvent<ReplaceEventContext>) => void;
|
615
|
-
|
616
|
-
/**
|
617
|
-
* 移动节点的时候触发,包括上移,下移
|
618
|
-
*/
|
619
|
-
beforeMove?: (event: PluginEvent<MoveEventContext>) => false | void;
|
620
|
-
aftterMove?: (event: PluginEvent<MoveEventContext>) => void;
|
621
|
-
|
622
|
-
/**
|
623
|
-
* 删除的时候触发
|
624
|
-
*/
|
625
|
-
beforeDelete?: (event: PluginEvent<DeleteEventContext>) => false | void;
|
626
|
-
afterDelete?: (event: PluginEvent<DeleteEventContext>) => void;
|
627
|
-
|
628
|
-
beforeResolveEditorInfo?: (
|
629
|
-
event: PluginEvent<RendererInfoResolveEventContext>
|
630
|
-
) => false | void;
|
631
|
-
afterResolveEditorInfo?: (
|
632
|
-
event: PluginEvent<RendererInfoResolveEventContext>
|
633
|
-
) => void;
|
634
|
-
|
635
|
-
beforeResolveJsonSchema?: (
|
636
|
-
event: PluginEvent<RendererJSONSchemaResolveEventContext>
|
637
|
-
) => false | void;
|
638
|
-
afterResolveJsonSchema?: (
|
639
|
-
event: PluginEvent<RendererJSONSchemaResolveEventContext>
|
640
|
-
) => void;
|
641
|
-
|
642
|
-
onDndAccept?: (event: PluginEvent<DragEventContext>) => false | void;
|
643
|
-
|
644
|
-
onBuildPanels?: (event: PluginEvent<BuildPanelEventContext>) => void;
|
645
|
-
|
646
|
-
onBuildContextMenus?: (event: PluginEvent<ContextMenuEventContext>) => void;
|
647
|
-
|
648
|
-
onBuildToolbars?: (event: PluginEvent<BaseEventContext>) => void;
|
649
|
-
|
650
|
-
onSelectionChange?: (event: PluginEvent<SelectionEventContext>) => void;
|
651
|
-
|
652
|
-
onPreventClick?: (
|
653
|
-
event: PluginEvent<PreventClickEventContext>
|
654
|
-
) => false | void;
|
655
|
-
|
656
|
-
onWidthChangeStart?: (
|
657
|
-
event: PluginEvent<
|
658
|
-
ResizeMoveEventContext,
|
659
|
-
{
|
660
|
-
onMove(e: MouseEvent): void;
|
661
|
-
onEnd(e: MouseEvent): void;
|
662
|
-
}
|
663
|
-
>
|
664
|
-
) => void;
|
665
|
-
|
666
|
-
onHeightChangeStart?: (
|
667
|
-
event: PluginEvent<
|
668
|
-
ResizeMoveEventContext,
|
669
|
-
{
|
670
|
-
onMove(e: MouseEvent): void;
|
671
|
-
onEnd(e: MouseEvent): void;
|
672
|
-
}
|
673
|
-
>
|
674
|
-
) => void;
|
675
|
-
|
676
|
-
onSizeChangeStart?: (
|
677
|
-
event: PluginEvent<
|
678
|
-
ResizeMoveEventContext,
|
679
|
-
{
|
680
|
-
onMove(e: MouseEvent): void;
|
681
|
-
onEnd(e: MouseEvent): void;
|
682
|
-
}
|
683
|
-
>
|
684
|
-
) => void;
|
685
|
-
}
|
686
|
-
|
687
|
-
/**
|
688
|
-
* 插件的 interface 定义
|
689
|
-
*/
|
690
|
-
export interface PluginInterface
|
691
|
-
extends Partial<BasicRendererInfo>,
|
692
|
-
Partial<BasicSubRenderInfo>,
|
693
|
-
PluginEventListener {
|
694
|
-
readonly manager: EditorManager;
|
695
|
-
|
696
|
-
order?: number;
|
697
|
-
|
698
|
-
/**
|
699
|
-
* 渲染器的名字,关联后不用自己实现 getRendererInfo 了。
|
700
|
-
*/
|
701
|
-
rendererName?: string;
|
702
|
-
|
703
|
-
/**
|
704
|
-
* 默认的配置面板信息
|
705
|
-
*/
|
706
|
-
panelIcon?: string;
|
707
|
-
panelTitle?: string;
|
708
|
-
|
709
|
-
/**
|
710
|
-
* 新增属性,用于判断是否出现在组件面板中,默认为false,为ture则不展示
|
711
|
-
*/
|
712
|
-
disabledRendererPlugin?: boolean;
|
713
|
-
|
714
|
-
/**
|
715
|
-
* @deprecated 用 panelBody
|
716
|
-
*/
|
717
|
-
panelControls?: Array<any>;
|
718
|
-
panelBody?: Array<any>;
|
719
|
-
panelDefinitions?: any;
|
720
|
-
panelApi?: any;
|
721
|
-
panelSubmitOnChange?: boolean;
|
722
|
-
|
723
|
-
/**
|
724
|
-
* @deprecated 用 panelBodyCreator
|
725
|
-
*/
|
726
|
-
panelControlsCreator?: (context: BaseEventContext) => Array<any>;
|
727
|
-
panelBodyCreator?: (context: BaseEventContext) => Array<any>;
|
728
|
-
|
729
|
-
popOverBody?: Array<any>;
|
730
|
-
popOverBodyCreator?: (context: BaseEventContext) => Array<any>;
|
731
|
-
|
732
|
-
/**
|
733
|
-
* 返回渲染器信息。不是每个插件都需要。
|
734
|
-
*/
|
735
|
-
getRendererInfo?: (
|
736
|
-
context: RendererInfoResolveEventContext
|
737
|
-
) => BasicRendererInfo | void;
|
738
|
-
|
739
|
-
/**
|
740
|
-
* 生成节点的 JSON Schema 的 uri 地址。
|
741
|
-
*/
|
742
|
-
buildJSONSchema?: (
|
743
|
-
context: RendererJSONSchemaResolveEventContext
|
744
|
-
) => void | string;
|
745
|
-
|
746
|
-
/**
|
747
|
-
* 构建右上角功能按钮集合
|
748
|
-
*/
|
749
|
-
buildEditorToolbar?: (
|
750
|
-
context: BaseEventContext,
|
751
|
-
toolbars: Array<BasicToolbarItem>
|
752
|
-
) => void;
|
753
|
-
|
754
|
-
/**
|
755
|
-
* 构建右键菜单项
|
756
|
-
*/
|
757
|
-
buildEditorContextMenu?: (
|
758
|
-
context: ContextMenuEventContext,
|
759
|
-
menus: Array<ContextMenuItem>
|
760
|
-
) => void;
|
761
|
-
|
762
|
-
/**
|
763
|
-
* 构建编辑器面板。
|
764
|
-
*/
|
765
|
-
buildEditorPanel?: (
|
766
|
-
context: BuildPanelEventContext,
|
767
|
-
panels: Array<BasicPanelItem>
|
768
|
-
) => void;
|
769
|
-
|
770
|
-
/**
|
771
|
-
* 构建子渲染器信息集合。
|
772
|
-
*/
|
773
|
-
buildSubRenderers?: (
|
774
|
-
context: RendererEventContext,
|
775
|
-
subRenderers: Array<SubRendererInfo>,
|
776
|
-
renderers: Array<RendererConfig>
|
777
|
-
) => BasicSubRenderInfo | Array<BasicSubRenderInfo> | void;
|
778
|
-
|
779
|
-
/**
|
780
|
-
* 更新NPM自定义组件分类和排序[异步方法]
|
781
|
-
* 备注:目前主要在npm自定义组件的分类和排序更新中使用
|
782
|
-
*/
|
783
|
-
asyncUpdateCustomSubRenderersInfo?: (
|
784
|
-
context: RendererEventContext,
|
785
|
-
subRenderers: Array<SubRendererInfo>,
|
786
|
-
renderers: Array<RendererConfig>
|
787
|
-
) => void;
|
788
|
-
|
789
|
-
markDom?: (dom: HTMLElement | Array<HTMLElement>, props: any) => void;
|
790
|
-
}
|
791
|
-
|
792
|
-
/**
|
793
|
-
* 基类,所有插件都继承这个好了,可以少写些逻辑。
|
794
|
-
*/
|
795
|
-
export abstract class BasePlugin implements PluginInterface {
|
796
|
-
constructor(readonly manager: EditorManager) {}
|
797
|
-
|
798
|
-
/**
|
799
|
-
* 如果配置里面有 rendererName 自动返回渲染器信息。
|
800
|
-
* @param renderer
|
801
|
-
*/
|
802
|
-
getRendererInfo({
|
803
|
-
renderer,
|
804
|
-
schema
|
805
|
-
}: RendererInfoResolveEventContext): BasicRendererInfo | void {
|
806
|
-
const plugin: PluginInterface = this;
|
807
|
-
|
808
|
-
if (
|
809
|
-
schema.$$id &&
|
810
|
-
plugin.name &&
|
811
|
-
plugin.rendererName &&
|
812
|
-
plugin.rendererName === renderer.name // renderer.name 会从 renderer.type 中取值
|
813
|
-
) {
|
814
|
-
// 复制部分信息出去
|
815
|
-
return {
|
816
|
-
name: plugin.name,
|
817
|
-
regions: plugin.regions,
|
818
|
-
patchContainers: plugin.patchContainers,
|
819
|
-
// wrapper: plugin.wrapper,
|
820
|
-
vRendererConfig: plugin.vRendererConfig,
|
821
|
-
wrapperProps: plugin.wrapperProps,
|
822
|
-
wrapperResolve: plugin.wrapperResolve,
|
823
|
-
filterProps: plugin.filterProps,
|
824
|
-
$schema: plugin.$schema,
|
825
|
-
renderRenderer: plugin.renderRenderer,
|
826
|
-
multifactor: plugin.multifactor,
|
827
|
-
scaffoldForm: plugin.scaffoldForm,
|
828
|
-
disabledRendererPlugin: plugin.disabledRendererPlugin,
|
829
|
-
isBaseComponent: plugin.isBaseComponent,
|
830
|
-
rendererName: plugin.rendererName
|
831
|
-
};
|
832
|
-
}
|
833
|
-
}
|
834
|
-
|
835
|
-
/**
|
836
|
-
* 配置了 panelControls 自动生成配置面板
|
837
|
-
* @param context
|
838
|
-
* @param panels
|
839
|
-
*/
|
840
|
-
buildEditorPanel(
|
841
|
-
context: BuildPanelEventContext,
|
842
|
-
panels: Array<BasicPanelItem>
|
843
|
-
) {
|
844
|
-
const plugin: PluginInterface = this;
|
845
|
-
const store = this.manager.store;
|
846
|
-
|
847
|
-
// 没有选中元素 或者 多选时不处理
|
848
|
-
if (!store.activeId || context.selections.length) {
|
849
|
-
return;
|
850
|
-
}
|
851
|
-
|
852
|
-
if (
|
853
|
-
!context.info.hostId &&
|
854
|
-
(plugin.panelControls ||
|
855
|
-
plugin.panelControlsCreator ||
|
856
|
-
plugin.panelBody ||
|
857
|
-
plugin.panelBodyCreator) &&
|
858
|
-
context.info.plugin === this
|
859
|
-
) {
|
860
|
-
panels.push({
|
861
|
-
key: 'config',
|
862
|
-
icon: plugin.panelIcon || plugin.icon || 'fa fa-cog',
|
863
|
-
title: plugin.panelTitle || '设置',
|
864
|
-
render: this.manager.makeSchemaFormRender({
|
865
|
-
definitions: plugin.panelDefinitions,
|
866
|
-
submitOnChange: plugin.panelSubmitOnChange,
|
867
|
-
api: plugin.panelApi,
|
868
|
-
body: plugin.panelBodyCreator
|
869
|
-
? plugin.panelBodyCreator(context)
|
870
|
-
: plugin.panelBody!,
|
871
|
-
controls: plugin.panelControlsCreator
|
872
|
-
? plugin.panelControlsCreator(context)
|
873
|
-
: plugin.panelControls!
|
874
|
-
})
|
875
|
-
});
|
876
|
-
} else if (
|
877
|
-
context.info.plugin === this &&
|
878
|
-
context.info.hostId &&
|
879
|
-
(plugin.vRendererConfig?.panelControls ||
|
880
|
-
plugin.vRendererConfig?.panelControlsCreator ||
|
881
|
-
plugin.vRendererConfig?.panelBody ||
|
882
|
-
plugin.vRendererConfig?.panelBodyCreator)
|
883
|
-
) {
|
884
|
-
panels.push({
|
885
|
-
key: context.info.multifactor ? 'vconfig' : 'config',
|
886
|
-
icon: plugin.vRendererConfig.panelIcon || 'fa fa-cog',
|
887
|
-
title: plugin.vRendererConfig.panelTitle || '设置',
|
888
|
-
render: this.manager.makeSchemaFormRender({
|
889
|
-
submitOnChange: plugin.panelSubmitOnChange,
|
890
|
-
api: plugin.panelApi,
|
891
|
-
definitions: plugin.vRendererConfig.panelDefinitions,
|
892
|
-
controls: plugin.vRendererConfig.panelControlsCreator
|
893
|
-
? plugin.vRendererConfig.panelControlsCreator(context)
|
894
|
-
: plugin.vRendererConfig.panelControls!,
|
895
|
-
body: plugin.vRendererConfig.panelBodyCreator
|
896
|
-
? plugin.vRendererConfig.panelBodyCreator(context)
|
897
|
-
: plugin.vRendererConfig.panelBody!
|
898
|
-
})
|
899
|
-
});
|
900
|
-
}
|
901
|
-
|
902
|
-
// 如果是个多重身份证
|
903
|
-
if (context.info.plugin === this && context.info.multifactor) {
|
904
|
-
const sameIdChild: EditorNodeType = context.node.sameIdChild;
|
905
|
-
|
906
|
-
if (sameIdChild) {
|
907
|
-
const subPanels = this.manager.collectPanels(sameIdChild, false, true);
|
908
|
-
subPanels.forEach(panel => {
|
909
|
-
if (panel.key === 'code') {
|
910
|
-
const exists = panels.some(panel => panel.key === 'code');
|
911
|
-
exists || panels.push(panel);
|
912
|
-
} else if (panel.key === 'renderers') {
|
913
|
-
const exists = panels.some(panel => panel.key === 'renderers');
|
914
|
-
exists || panels.push(panel);
|
915
|
-
} else if (
|
916
|
-
panel.key === 'outline' ||
|
917
|
-
panel.key === 'commonConfig' ||
|
918
|
-
panel.key === 'name-list'
|
919
|
-
) {
|
920
|
-
// do nothing
|
921
|
-
} else {
|
922
|
-
panels.push({
|
923
|
-
...panel,
|
924
|
-
key: `sub-${panel.key}`,
|
925
|
-
icon: sameIdChild.info?.plugin?.icon || panel.icon
|
926
|
-
});
|
927
|
-
}
|
928
|
-
});
|
929
|
-
}
|
930
|
-
}
|
931
|
-
}
|
932
|
-
|
933
|
-
/**
|
934
|
-
* 默认什么组件都加入的子组件里面,子类里面可以复写这个改变行为。
|
935
|
-
* @param context
|
936
|
-
* @param subRenderers
|
937
|
-
*/
|
938
|
-
buildSubRenderers(
|
939
|
-
context: RendererEventContext,
|
940
|
-
subRenderers: Array<SubRendererInfo>,
|
941
|
-
renderers: Array<RendererConfig>
|
942
|
-
): BasicSubRenderInfo | Array<BasicSubRenderInfo> | void {
|
943
|
-
const plugin: PluginInterface = this;
|
944
|
-
|
945
|
-
if (Array.isArray(plugin.scaffolds)) {
|
946
|
-
return plugin.scaffolds.map(scaffold => ({
|
947
|
-
name: (scaffold.name ?? plugin.name)!,
|
948
|
-
icon: scaffold.icon ?? plugin.icon,
|
949
|
-
description: scaffold.description ?? plugin.description,
|
950
|
-
previewSchema: scaffold.previewSchema ?? plugin.previewSchema,
|
951
|
-
tags: scaffold.tags ?? plugin.tags,
|
952
|
-
docLink: scaffold.docLink ?? plugin.docLink,
|
953
|
-
type: scaffold.type ?? plugin.type,
|
954
|
-
scaffold: scaffold.scaffold ?? plugin.scaffold,
|
955
|
-
scaffoldForm: plugin.scaffoldForm,
|
956
|
-
disabledRendererPlugin: plugin.disabledRendererPlugin,
|
957
|
-
isBaseComponent: plugin.isBaseComponent,
|
958
|
-
rendererName: plugin.rendererName
|
959
|
-
}));
|
960
|
-
} else if (plugin.name && plugin.description) {
|
961
|
-
return {
|
962
|
-
name: plugin.name,
|
963
|
-
icon: plugin.icon,
|
964
|
-
description: plugin.description,
|
965
|
-
previewSchema: plugin.previewSchema,
|
966
|
-
tags: plugin.tags,
|
967
|
-
docLink: plugin.docLink,
|
968
|
-
type: plugin.type,
|
969
|
-
scaffold: plugin.scaffold,
|
970
|
-
scaffoldForm: plugin.scaffoldForm,
|
971
|
-
disabledRendererPlugin: plugin.disabledRendererPlugin,
|
972
|
-
isBaseComponent: plugin.isBaseComponent,
|
973
|
-
rendererName: plugin.rendererName
|
974
|
-
};
|
975
|
-
}
|
976
|
-
}
|
977
|
-
|
978
|
-
/**
|
979
|
-
* 构建当前选中组件的右键菜单
|
980
|
-
* @param id
|
981
|
-
* @param schema
|
982
|
-
* @param region
|
983
|
-
* @param info
|
984
|
-
* @param menus
|
985
|
-
*/
|
986
|
-
buildEditorContextMenu(
|
987
|
-
{id, schema, region, info, selections}: ContextMenuEventContext,
|
988
|
-
menus: Array<ContextMenuItem>
|
989
|
-
) {
|
990
|
-
const plugin: PluginInterface = this;
|
991
|
-
if (
|
992
|
-
info.plugin === plugin &&
|
993
|
-
!selections.length &&
|
994
|
-
(plugin.scaffoldForm?.canRebuild || info.scaffoldForm?.canRebuild)
|
995
|
-
) {
|
996
|
-
menus.push({
|
997
|
-
label: `快速构建「${info.plugin.name}」`,
|
998
|
-
disabled: schema.$$commonSchema,
|
999
|
-
onSelect: () =>
|
1000
|
-
this.manager.reScaffold(
|
1001
|
-
id,
|
1002
|
-
info.scaffoldForm || plugin.scaffoldForm!,
|
1003
|
-
schema
|
1004
|
-
)
|
1005
|
-
});
|
1006
|
-
}
|
1007
|
-
}
|
1008
|
-
|
1009
|
-
buildEditorToolbar(
|
1010
|
-
{id, schema, info}: BaseEventContext,
|
1011
|
-
toolbars: Array<BasicToolbarItem>
|
1012
|
-
) {
|
1013
|
-
const plugin: PluginInterface = this;
|
1014
|
-
if (
|
1015
|
-
info.plugin === plugin &&
|
1016
|
-
(plugin.scaffoldForm?.canRebuild || info.scaffoldForm?.canRebuild)
|
1017
|
-
) {
|
1018
|
-
toolbars.push({
|
1019
|
-
iconSvg: 'harmmer',
|
1020
|
-
tooltip: `快速构建「${info.plugin.name}」`,
|
1021
|
-
placement: 'bottom',
|
1022
|
-
onClick: () =>
|
1023
|
-
this.manager.reScaffold(
|
1024
|
-
id,
|
1025
|
-
info.scaffoldForm || plugin.scaffoldForm!,
|
1026
|
-
schema
|
1027
|
-
)
|
1028
|
-
});
|
1029
|
-
}
|
1030
|
-
}
|
1031
|
-
|
1032
|
-
renderPlaceholder(text: string, key?: any) {
|
1033
|
-
return React.createElement('div', {
|
1034
|
-
key,
|
1035
|
-
className: 'wrapper-sm b-a b-light m-b-sm',
|
1036
|
-
children: React.createElement('span', {
|
1037
|
-
className: 'text-muted',
|
1038
|
-
children: text
|
1039
|
-
})
|
1040
|
-
});
|
1041
|
-
}
|
1042
|
-
|
1043
|
-
getPlugin(rendererNameOrKlass: string | typeof BasePlugin) {
|
1044
|
-
return find(this.manager.plugins, plugin =>
|
1045
|
-
typeof rendererNameOrKlass === 'string'
|
1046
|
-
? plugin.rendererName === rendererNameOrKlass
|
1047
|
-
: plugin instanceof rendererNameOrKlass
|
1048
|
-
);
|
1049
|
-
}
|
1050
|
-
}
|